嘟嘟社区

小红包求nginx反代写法


  1. location /photo/ {
  2.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  3.         proxy_set_header Host $host;
  4.         proxy_pass http://127.0.0.1:2342/;
  5.         proxy_buffering off;
  6.         proxy_http_version 1.1;
  7.         proxy_set_header Upgrade $http_upgrade;
  8.         proxy_set_header Connection "upgrade";
  9.         client_max_body_size 500M;}

复制代码

本来是这样写的.结果访问的时候静态资源全部404,正常的应该是到/photo/*.css,结果请求的全是在/底下.也试过location后面加~^,源站后面加,或者加入rewrite,全都不行.希望有大佬教教我

proxy_pass http://127.0.0.1:2342
proxy_pass你加盐了