m0_37542124 2019-11-11 17:16 采纳率: 0%
浏览 426

请教一个nginx代理的问题:相同域名不同端口的两个网站,分别使用了nginx代理都是通过location去匹配的,站点1的location / 站点2的location code/login 访问结果站点2的静态资源访问不到?

相同域名不同端口的两个网站,分别使用了nginx代理都是通过location去匹配的,站点1的location / 站点2的location code/login 访问结果站点2的静态资源访问不到?

站点1 conf配置:
location / {

      root   /xxxxxx/pinpoint-web-1.8.1;
      index  index.html index.htm;
      auth_basic   "Input Password:";
      auth_basic_user_file "/usr/local/nginx/pass";
      proxy_pass   https://xxxxxxx:8444/;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $host;

}

站点2 conf配置:
location /code/login {
root /xxxxx/core;
index login.html index.html index.htm;
proxy_pass https://xxxxxx:8443/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}
  • 写回答

1条回答 默认 最新

  • weixin_43975295 2019-11-12 09:44
    关注

    感觉你的这个location写的有点奇怪,既然location中写了proxy_pass,就是把匹配该location的url直接转发走了,那为何还要在location中指定root目录呢?这两者是冲突的。

    评论

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗