标签:
client_header_timeout 3000;
client_body_timeout 3000;
fastcgi_read_timeout 3000;
client_max_body_size 32m;
fastcgi_buffers 8 128k;
fastcgi_buffer_size 128k;
在Event模块中修改:
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535;
}
进入配置文件目录:
cd /etc/nginx/conf.d/
给需要代理的域名添加配置文件:
vi websiteProxy.conf
server {
listen 80;
server_name app.website.com;
location / {
proxy_pass http://192.168.10.100;
proxy_connect_timeout 120;
proxy_read_timeout 600;
proxy_send_timeout 600;
send_timeout 600;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
如上配置即可实现反向代理功能,若需要实现负载均衡,可添加upstream模块,按照如下配置:
upstream appservers {
server 192.168.10.100 weight=3;
server 192.168.10.101 weight=2;
}
server {
listen 80;
server_name app1.website.com;
location / {
proxy_pass http://appservers;
proxy_connect_timeout 120;
proxy_read_timeout 600;
proxy_send_timeout 600;
send_timeout 600;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
使用 ulimit 命令,查看 linux 系统文件句柄并发限制。
$ ulimit -n
1024
linux 系统默认设为 1024,我们需要将该值设为 65535。
修改系统文件 /etc/security/limits.conf,添加如下信息,并重新启动系统生效。
* soft nofile 65535
* hard nofile 65535
标签:
原文地址:http://www.cnblogs.com/Mrhuangrui/p/4560294.html