1 2 |
|
centeros平台可以使用如下命令。
1 2 3 4 5 6 |
|
1 2 |
|
1 |
|
1 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#重启nginx 进入nginx安装目录sbin下执行./nginx -s reload
|
同一个域名代理多个ip+port
nginx.conf 具体配置如下:
server {
listen 8087;
server_name a.b.com.cn; #域名
#root html;
#index index.html index.htm index.py index;
## send request back to Tornado ##
location ^~ /data { #固定的context(项目名)
proxy_pass http://192.16.41.1:8080/data;
#Proxy Settings
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_max_temp_file_size 0;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location ^~ /test { #固定的context(项目名)
proxy_pass http://192.16.41.2:8080/test;
#Proxy Settings
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_max_temp_file_size 0;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}