如何解决 Nginx 访问静态页面被重定向到登录页?-灵析社区

莫克先森

nginx 访问静态页面被重定向ruoyi登录页 # Settings for a TLS enabled server. server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name xxx.top; root /usr/share/nginx/html; ssl_certificate "/etc/nginx/cert/server.crt"; ssl_certificate_key "/etc/nginx/cert/server.key"; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_ciphers PROFILE=SYSTEM; ssl_prefer_server_ciphers on; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; # location / { root /app/ruoyi-ui; try_files $uri $uri/ /index.html; index index.html index.htm; } 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://139.9.141.96:8080/; } location /protocol/ { index index.html; alias /app/ruoyi-ui/protocol/; autoindex on; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } 访问[https://xxx.top/protocol/](https://link.segmentfault.com/?enc=qmIxdpWxLmj9lSUf7oB7hg%3D%3D.nR%2BEJIy3Sb4%2BhUqPHiuSV2qlmsr7Q%2B2A%2FLcB7GhS5fw%3D)的时候,被重定向到登录页了就,求大佬给看看,我想访问到protocol/下的index.html 求大佬给看看,我想访问到protocol/下的index.html 而不是重定向到登录页

阅读量:194

点赞量:0

问AI
"include /etc/nginx/default.d/*.conf;" 这里的include 不知道你加了什么配置; location /protocol/ { index index.html; alias /app/ruoyi-ui/protocol/; autoindex on; ** access_log /var/log/access.log;** } 这里location可以加一个access log 看下请求有没有到这里,另外还有一种可能就是请求已经进入到了这个location里,但是前端自行跳转到了登录页,比如vue项目判断本地没有token时自行重定向到登录页,这种情况nginx上是改不了的。