Nginx 反向代理 [改进中....]
xi2008wang
|
1#
xi2008wang 发表于 2008-09-27 15:16
Nginx 反向代理 [改进中....]
[Copy to clipboard] [ - ]
CODE:
<<nginx.conf设置>>
#user nobody; worker_processes 4; error_log logs/error.log crit; pid logs/nginx.pid; worker_rlimit_nofile 10240; events { use epoll; worker_connections 51200; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; tcp_nodelay on; # server pool upstream bspfrontsvr { server 10.10.10.224:80 weight=1; server 10.10.10.221:80 weight=1; } upstream bspimgsvr { server 10.10.10.201:80 weight=1; } upstream bspstylesvr { server 10.10.10.202:80 weight=1; } upstream bsphelpsvr { server 10.10.10.204:80 weight=1; } upstream bspwsisvr { server 10.10.10.203:80 weight=1; } upstream bspadminsvr { server 10.10.10.222:80 weight=1; } upstream bspbuyersvr { server 10.10.10.223:80 weight=1; } upstream bspsellersvr { server 10.10.10.225:80 weight=1; } upstream bsploginsvr { server 10.10.10.220:443 weight=1; } upstream bspregistersvr { server 10.10.10.220:80 weight=1; } log_format test_com '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" "$http_user_agent" '; #-------------------------------------------------------------------- #img.test.com server { listen 10.10.10.230:80; server_name img.test.com; location / { proxy_pass http://bspimgsvr; include proxy_setting.conf; } access_log logs/img.log test_com; } #style.test.com server { listen 10.10.10.230:80; server_name style.test.com; location / { proxy_pass http://bspstylesvr; include proxy_setting.conf; } access_log logs/style.log test_com; } #help.test.com server { listen 10.10.10.230:80; server_name help.test.com; location / { proxy_pass http://bsphelpsvr; include proxy_setting.conf; } access_log logs/help.log test_com; } #admin.test.com server { listen 10.10.10.230:80; server_name admin.test.com; location / { proxy_pass http://bspadminsvr; include proxy_setting.conf; } access_log logs/admin.log test_com; } #buyer.test.com server { listen 10.10.10.230:80; server_name buyer.test.com; location / { proxy_pass http://bspbuyersvr; include proxy_setting.conf; } access_log logs/buyer.log test_com; } #seller.test.com server { listen 10.10.10.230:80; server_name seller.test.com; location / { proxy_pass http://bspsellersvr; include proxy_setting.conf; } access_log logs/seller.log test_com; } #wsi.test.com server { listen 10.10.10.230:80; server_name wsi.test.com; location / { proxy_pass http://bspwsisvr; include proxy_setting.conf; } access_log logs/wsi.log test_com; } #www.test.com server { listen 10.10.10.230:80; server_name www.test.com *.test.com; location ~ ^/NginxStatus/ { stub_status on; access_log off; } location / { proxy_pass http://bspfrontsvr; include proxy_setting.conf; } access_log logs/www.log test_com; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } #login.test.com server { listen 10.10.10.230:443; server_name login.test.com; ssl on; ssl_certificate cert.pem; ssl_certificate_key cert.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; ssl_prefer_server_ciphers on; location / { proxy_pass https://bsploginsvr; include proxy_setting.conf; } access_log logs/login.log test_com; } #login.test.com for register server { listen 10.10.10.230:80; server_name login.test.com; location / { proxy_pass http://bspregistersvr; include proxy_setting.conf; } access_log logs/register.log test_com; } } <<conf/proxy_setting.conf设置>> 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; client_max_body_size 10m; client_body_buffer_size 128k; 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; |