123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- upstream backend_servers {
- server backend: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://backend_servers;
-
- # 代理头信息配置
- 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_set_header X-Forwarded-Proto $scheme;
- }
-
- location /ws {
- proxy_read_timeout 300;
- proxy_pass http://backend_servers;
-
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- # 代理头信息配置
- 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_set_header X-Forwarded-Proto $scheme;
- }
-
- # 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;
- # }
- }
|