server { listen 5173; server_name _; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { # 不缓存html,防止程序更新后缓存继续生效 if ($request_filename ~* .*\.(?:htm|html)$) { add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; access_log on; } # 这里是vue打包文件dist内的文件的存放路径 root /usr/share/nginx/html/frontend/; index index.html index.htm; try_files $uri $uri/ /index.html; } location /prod-api/ { proxy_set_header HOST $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://mhms-admin:8080/; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }