map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80 ; listen [::]:80; server_name localhost; location / { root /etc/nginx/html; index index.html index.htm; try_files $uri /index.html; } # 后端跨域请求 location ~/admin/ { proxy_pass http://172.17.0.1:1000; proxy_set_header Host $http_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; } error_page 404 404.html; location = /50x.html { root html; } }