无论您在MikroTik上碰到什么问题,本站都可以为您排忧解难。远离烦恼,腾出您宝贵的精力和时间处理更加有价值的事情。 注册 | 登陆
浏览模式: 标准 | 列表全部文章

Debian6下lighttpd+php安装

安装很简单,只用下面的一条命令,就可以了:

apt-get install lighttpd php5-cgi

安装完成后,还要设置lighttpd来使他支持php,用下面的命令启用php支持:
lighttpd-enable-mod  fastcgi fastcgi-php

之后,运行:
/etc/init.d/lighttpd force-reload
lighttpd 就可以支持php了。

» 阅读全文

Tags: debian, lighttpd, php, 安装

ROS的ADSL多线DDNS

DDNS脚本自动绑定到默认路由的接口更新IP

:global ddnsuser "用户名"
:global ddnspass "密码"
:global ddnshost "域名"
:global gate [/ip route get [/ip route find static=yes active=yes dynamic=yes distance=1] gateway]
:global ddnsinterface {:put [/ip add get [find network=$gate] interface]}
:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass

» 阅读全文

Tags: ros, adsl, 多线, ddns, 脚本

ROS的ADSL多线映射脚本

映射脚本自动绑定到默认路由的接口更新IP

--------------对NAT规则备注名进行查找-----------------
:global adcmname "3389"
:global adgw [/ip route get [/ip route find static=yes active=yes dynamic=yes distance=1] gateway]
:global ip [/ip add get [find network=$adgw] address]
:global newip [:pick $ip 0 [:find $ip "/"]]
:global oldip [/ip fi nat get [/ip fi nat find comment=$adcmname] dst-address]
:if ($newip != $oldip) do={
        :log info [/ip fi nat set [/ip firewall nat find comment=$adcmname] dst-address=$newip]
}

» 阅读全文

Tags: ros, adsl, 多线, 映射, 脚本

统计在线人数专业版

#内网地址段改为自己的
/ip firewall address-list add address=192.168.1.0/24 disabled=no list=lan
/ip firewall mangle add action=add-src-to-address-list address-list=Online address-list-timeout=1m chain=prerouting comment=tongji disabled=no src-address-list=lan

/system scheduler
add comment=tongji disabled=no interval=3m name="\CD\B3\BC\C6" on-event="#\D7\EE\B4\F3\D1\AD\BB\B7\B4\CE\CA\FD\r\
    \n:global rmaxlimit 5000\r\
    \n:global r 0\r\
    \n:global rn\r\
    \n:global rs\r\
    \n:global ravg\r\
    \n:global rmax\r\
    \n:if ([:len \$ravg] = 0) do={\r\
    \n:set ravg 0\r\
    \n:global rn 0\r\
    \n:global rs 0\r\
    \n:global rmax 0}\r\
    \n:if (\$rs = \$rmaxlimit) do={\r\
    \n:global rn \$ravg\r\
    \n:global rs 1}\r\
    \n:foreach b in=[/ip firewall add find list=\"Online\"] do={:set r (\$r+1)}\r\
    \n:if (\$rmax < \$r) do={:set rmax \$r}\r\
    \n:set rs (\$rs+1)\r\
    \n:set rn (\$rn+\$r)\r\
    \n:global ravg (\$rn / \$rs)\r\
    \n:log warning (\"\B5\B1\C7\B0\D4\DA\CF\DF\BF\CD\BB\A7\BB\FA\" . \$r . \"\CC\A8,\C6\BD\BE\F9\D4\DA\CF\DF\BF\CD\BB\A7\BB\FA\"\
    \_. \$ravg . \",\D7\EE\B8\DF\D4\DA\CF\DF\C0\FA\CA\B7\" . \$rmax . \"\CC\A8,\B5\B1\C7\B0\CD\B3\BC\C6\B4\CE\CA\FD\" . \$rs . \
    \"\A1\A3\")" policy=reboot,read,write,policy,test,password,sniff,sensitive start-date=jan/01/1970 start-time=00:00:00

» 阅读全文

Tags: 统计, 在线, 人数, ros, 脚本

nginx限速及连接数限制

在nginx.conf的http{}添加
limit_zone one $binary_remote_addr 10m;

然后在 虚拟机里写
location / {
limit_conn one 1; 线程
limit_rate 100k; 速度
表示限速100K 每个客户端只允许一个线程

最终速度=rate * conn

-----------------------------------------------------------------

limit_zone one $binary_remote_addr 32k;
server {
listen       80;
server_name  192.168.1.222;
location / {
root   /var/www/html;
index  index.html index.htm index.php;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
limit_conn one 2;
limit_rate 10k;
}


说明:

limit_zone,针对每个IP定义一个存储session状态的容器。要求大于等于32K。

limit_conn,限制每个IP发起的连接数,比如本实例设了2个,当我用IE进行单线程下载的时候还可以打开该站点的一个网页。而用迅雷下载时,迅雷会启用2个线程下载,所以当再去打开网页的时候,服务器端会返回错误请求。该值建议设置得高一些,比如15左右。

limit_rate,限制每个连接速度为10K,此限制是针对单个线程,比如这个例子,我用IE下载是10K,当用迅雷时它会占用2个线程,所以迅雷下载速度为20K,此实例也很好的解释了迅雷下载速度快的原因。

» 阅读全文

Tags: nginx, 限速, 连接数, 限制, 并发