nginx静态资源无效问题

1.先说问题

在nginx转发访问某个页面的时候,效果展示:
非转发形式:

转发:

nginx代理配置文件添加:

location /njazx {
proxy_pass http://localhost:8088/njazx;

proxy_params

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;
}

https://blog.csdn.net/zhangjunli/article/details/80436489

2. 重定向次数问题。

在根路径下配置转发

server {
listen 88;
server_name localhost;

charset koi8-r;

access_log logs/host.access.log main;

location / {
proxy_pass http://localhost:8089/disk; //若此处disk没有后缀(没有访问到该文件下的资源)——disk/,就会出现重定向错误问题。
}

posted on 2021-10-18 10:38  汤姆猫8  阅读(946)  评论(0)    收藏  举报