worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream test {
#根据ip计算将请求分配各那个后端tomcat,许多人误认为可以解决session问题,其实并不能。
#同一机器在多网情况下,路由切换,ip可能不同
#ip_hash;
server ****:8180;
server ****:8180;
}
server {
listen 8180;
server_name test;
#对aspx后缀的进行负载均衡请求
location / {
proxy_connect_timeout 3;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_pass http://test/;
}
add_header X-Via $server_addr;
add_header X_cache_hit $upstream_cache_status;
}
}
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ps -ef|grep nginx
kill -QUIT **** #从容停止
kill -TERM **** 或 kill -INT **** #快速停止
pkill -9 nginx #强制停止