server { listen 80 default_server; listen [::]:80 default_server; root /usr/share/nginx/html; index index.html index.htm; location / { try_files $uri $uri/ @rewrites; } location /spc/ { proxy_pass http://58.210.206.230:8000/; } location /api { access_log off; add_header Access-Control-Allow-Origin * always; add_header Access-Control-Allow-Methods GET,OPTIONS,POST,GET,PUT,DELETE always; add_header Access-Control-Allow-Headers $http_access_control_request_headers; add_header Access-Control-Allow-Credentials true; add_header Access-Control-Max-Age 1800; if ($request_method = OPTIONS){ add_header Access-Control-Allow-Origin * always; add_header Access-Control-Allow-Methods GET,OPTIONS,POST,GET,PUT,DELETE always; add_header Access-Control-Allow-Headers $http_access_control_request_headers; add_header Access-Control-Allow-Credentials true; add_header Access-Control-Max-Age 1800; return 204; } 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_buffering off; proxy_pass http://mes:9090/api; proxy_http_version 1.1; } location @rewrites { rewrite ^(.+)$ /index.html last; } location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { expires max; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } }