发布于 2016-02-06 07:05:43 | 187 次阅读 | 评论: 0 | 来源: 网友投递
这里有新鲜出炉的Nginx开发从入门到精通,程序狗速度看过来!
Nginx WEB服务器
Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。
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>