前端请求 /
nginx配置
server {
listen *:8008;
root /home/pyweb/help_test/frontend/dist;
location = / {
index index.html; # 访问 / 将内部代理到 /index.html
}
location = /index.html {} # 必填因为否则将会代理到 localtion / 那里交由 0.0.0.0:8012处理
location /assets {} # 有root,优先访问 {root}/assets
location /vite.svg {} # 有root,优先访问 {root}/vite.svg
location =/ws {
proxy_read_timeout 120s;
proxy_pass http://0.0.0.0:8022;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location / {
proxy_read_timeout 120s;
proxy_pass http://0.0.0.0:8012;
}
}