Nginx将不同IP的请求分发到不同的WEB服务器
server { listen 80; server_name localhost; large_client_header_buffers 4 16k; client_max_body_size 300m; client_body_buffer_size 128k; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; proxy_buffer_size 64k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; location / { root html; index index.html index.htm; } location /project { proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; if ($remote_addr ~ "192.168.9.138") { proxy_pass http://project1.server.com; break; } proxy_pass http://project2.server.com; } error_page 502 /502.html; location = /502.html { root html; } }