upstream backed_server { server 192.168.6.251:8080 max_fails=1 fail_timeout=10s; server 192.168.3.251:8080 max_fails=1 fail_timeout=10s; } server { listen 80; server_name localhost; #charset koi8-r; access_log /var/log/nginx/host.access.log main; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 8; gzip_types text/plain application/javascript application/x-javascript text/css application/json text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]\."; location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; index start.html index.html; } location /api { proxy_read_timeout 300; proxy_pass http://backed_server; } location /ws { proxy_read_timeout 300; proxy_pass http://backed_server; } # location /api { # proxy_read_timeout 300; # proxy_pass http://192.168.3.177:8080; # } # location /ws { # proxy_read_timeout 300; # proxy_pass http://192.168.3.177:8080/ws; # } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # location /api { # proxy_pass http://api-server:8082; # } }