【问题标题】:nginx or apache add port if in url no slash如果 url 中没有斜杠,nginx 或 apache 添加端口
【发布时间】:2014-01-04 01:27:53
【问题描述】:

我有 nginx+apache+php 配置。 如果在我的浏览器中我写“http://example.com”服务器将我重定向到“http//example.com:8080”(8080 是我的 Apache 端口),但如果我添加斜杠(如 example.com/)工作正常。 nginx 配置:

server {
    location / {
            proxy_pass   http://127.0.0.1:8080;
            proxy_read_timeout 600;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header  X-Forwarded-For   $remote_addr;
            proxy_buffering off;
    }

【问题讨论】:

    标签: php apache web nginx


    【解决方案1】:

    解决方法:在 nginx 配置行中添加:

    port_in_redirect off;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-03
      • 1970-01-01
      • 2016-01-18
      • 2023-03-23
      • 2014-09-21
      • 2012-05-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多