求助 nginx配置 部署前端相关
我用的ant design pro的默认配置. 配置到8088根目录下,直接访问能正常访问。现在想通过 8001/test/ 转发访问. 问题是 js和css全报404
server {
listen 8001;
#location ~ .*\.(js|css|jpg|jpeg|gif|png|ico|pdf|txt)$ {
# proxy_pass http://127.0.0.1:8088;
#}
location /test/{
proxy_pass http://127.0.0.1:8088/;
proxy_set_header host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 8088 default_server;
server_name somename alias another.alias;
location / {
try_files $uri $uri/ /index.html;
root D:\website;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
```