【问题标题】:configuring subdirectory app in nginx在 nginx 中配置子目录应用程序
【发布时间】:2012-11-13 14:58:15
【问题描述】:

谁能帮我在哪里配置我的 nginx:

/app -> 是本地的html页面

/ -> 是没有app文件夹的https服务器

以下配置对我不起作用:(

server {
    listen              80;
    ssl_verify_client   off;
    server_name         localhost;
    location / {
        proxy_pass_header Server;
        proxy_set_header  Host $http_host;
        proxy_set_header  X-Real-IP $remote_addr;
        proxy_set_header  X-Scheme $scheme;
        proxy_pass        https://xx.xx.xx.xx/;
    }
    location /app {
      root "c:\LOCAL_PATH\app";
      index  index.html;
    }
}

【问题讨论】:

  • 您是否将 https 请求路由到同一服务器?

标签: nginx


【解决方案1】:

将您的location /-block 换成以下应该这样做:

location / { rewrite ^ https://$host$request_uri?; }

【讨论】:

  • 这不起作用。事实上 /root 现在重定向到 ip 地址
  • 据我了解,您希望/app-path 中的所有内容都在本地提供(您的location /app-block 会这样做),其他所有内容都应该由(并因此重定向到)提供服务https 服务器(这是重写所做的)。我误解了你在这里完全想要什么吗?
猜你喜欢
  • 1970-01-01
  • 2023-03-12
  • 1970-01-01
  • 2013-09-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-20
相关资源
最近更新 更多