map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
     listen 80 ;
     listen       [::]:80;
     server_name localhost;
     client_max_body_size 5M; # 最大文件上传设置

     location / {
         root   /etc/nginx/html;
         index  index.html index.htm;
         try_files $uri /index.html;
     }

     # 后端跨域请求
     location ~/api/ {
         proxy_pass http://172.17.0.1:8000;
         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;
     }
}
