nginx限制访问频率
2015-07-16 10:17
531 查看
修改服务器上的nginx的配置文件/usr/local/nginx/conf/nginx.confhttp { limit_req_zone $binary_remote_addr zone=one:10m rate=3000r/m; proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; proxy_temp_path /var/tmp;
include mime.types; default_type application/octet-stream;
gzip on; gzip_comp_level 6; gzip_vary on; gzip_min_length 1000; gzip_proxied any; gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_buffers 16 8k;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on; #tcp_nopush on;
#keepalive_timeout 0; keepalive_timeout 65;
#gzip on;
upstream wedate{ server 10.0.0.48:8080; server 10.0.0.50:8080; } server { listen 8080; server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / { limit_req zone=wedate_zone burst=30; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_cache one; proxy_cache_key sfs$request_uri$scheme; proxy_pass http://wedate; }nginx平滑重启、 nginx -t -c /usr/local/nginx/conf/nginx.conf
include mime.types; default_type application/octet-stream;
gzip on; gzip_comp_level 6; gzip_vary on; gzip_min_length 1000; gzip_proxied any; gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_buffers 16 8k;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on; #tcp_nopush on;
#keepalive_timeout 0; keepalive_timeout 65;
#gzip on;
upstream wedate{ server 10.0.0.48:8080; server 10.0.0.50:8080; } server { listen 8080; server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / { limit_req zone=wedate_zone burst=30; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_cache one; proxy_cache_key sfs$request_uri$scheme; proxy_pass http://wedate; }nginx平滑重启、 nginx -t -c /usr/local/nginx/conf/nginx.conf
相关文章推荐
- Nginx优化详细,应对高并发
- Nginx优化详细,应对高并发
- nginx 1.6.2源码分析2 499问题之upstream
- 初探nginx架构
- 让nginx支持PATH_INFO
- Nginx负载均衡和LVS负载均衡的比较分析
- nginx通配符
- nginx.conf配置说明
- nginx
- Nginx配置文件nginx.conf中文详解(总结)
- windows下安装nginx
- Nginx与jetty结合
- nginx模块
- virtualenv 环境下 Nginx + Flask + Gunicorn+ Supervisor 搭建 Python Web
- Ubuntn下Nginx安装流程
- virtualenv 环境下 Flask + Nginx + Gunicorn+ Supervisor 搭建 Python Web
- Nginx站点搭建和自定义日志文件
- windows下nginx的启动关闭
- 基于NodeJS的前后端分离的思考与实践(六)Nginx + Node.js + Java 的软件栈部署实践
- nginx日志文件切割