- nginx部署一直404访问不通,不知道为啥日志打印出来的就是不走location配置的代理服务器?
user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; server { listen 443; server_name holmes-center-front-86714-6-1323419690.sh.run.tcloudbase.com; index index.html index.htm; error_page 404 /404.html; error_page 500 502 503 504 /50x.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_intercept_errors on; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass https://dlnmpwnf.xx.hahsntqc.ie54110f.com; } location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; index index.html index.htm; } location = /50x.html { root /usr/share/nginx/html; } } } nginx配置如上: 2024/01/15 06:56:51 [error] 37#37: *99 open() "/usr/share/nginx/html/prod-api/captchaImage" failed (2: No such file or directory), client: 10.40.254.165, server: localhost, request: "GET /prod-api/captchaImage HTTP/1.1", host: "holmes-center-front-86714-6-1323419690.sh.run.tcloudbase.com", referrer: "https://holmes-center-front-86714-6-1323419690.sh.run.tcloudbase.com/login?redirect=%2Findex" 不去走代理配置的location ,反而去走了/usr/share/nginx/html/prod-api/captchaImage本地路径,配置了好久没成功,问题应该出在了ngxin配置上,求解带!
01-15 - nginx反向代理 微信云托管的服务返回404?
静态页面部署在前端服务器上,后端使用的是微信云托管的服务,通过前端nginx反向代理调用,但返回404
04-24