1.配置nginx代理开启长连接
[root@lb01 ~]# vim /etc/nginx/conf.d/proxy.conf
upstream web {
server 172.16.1.7:80;
keepalive 16; #开启长连接
}
server {
listen 80;
server_name linux.node.com;
location / {
proxy_pass http://web;
proxy_http_version 1.1; #指定长连接版本
include /etc/nginx/proxy_params;
}
}
2.配置nginx代理PHP开启长连接
[root@web01 ~]# cat /etc/nginx/conf.d/linux.blog.com.conf
server {
listen 80;
server_name linux.blog.com;
root /code/wordpress;
location ~* .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_keep_conn on; #配置代理http开启长连接
include fastcgi_params;
}
}