復制代碼 代碼如下:
vi /usr/local/nginx/conf/vhosts/down.redocn.com.conf
limit_zone one $binary_remote_addr 10m;
server
{
listen 80;
server_name down.redocn.com;
index index.html index.htm index.php;
root /data/www/wwwroot/down;
error_page 404 /index.php;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#Zone limit
location / {
limit_conn one 1;
limit_rate 20k;//限速
}
# serve static files
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /data/www/wwwroot/down;
expires 30d;
}
}
復制代碼 代碼如下:
ExtendedStatus On
LoadModule limitipconn_module modules/mod_limitipconn.so < IfModule mod_limitipconn.c >
< Location / > # 所有虛擬主機的/目錄
MaxConnPerIP 3 # 每IP只允許3個并發連接
NoIPLimit image/* # 對圖片不做IP限制
< /Location>
< Location /mp3 > # 所有主機的/mp3目錄
MaxConnPerIP 1 # 每IP只允許一個連接請求
OnlyIPLimit audio/mpeg video # 該限制只對視頻和音頻格式的文件
< /Location >
< /IfModule>
新聞熱點
疑難解答