【问题标题】:SSL proxy for two applications on separate ports on one host name一个主机名上不同端口上的两个应用程序的 SSL 代理
【发布时间】:2023-04-08 15:37:01
【问题描述】:

我们使用 Nginx 作为 SSL 代理,并且在两个不同的端口上有一个主机名和两个应用程序。如果可能的话,在 nginx.conf 中进行设置的最佳方法是什么。

【问题讨论】:

  • 我想添加我已经尝试在主服务器下添加第二个监听,但它似乎只接收第一个而根本不使用第二个。
  • 解决了。我只需要为新端口添加另一条监听线,并允许人们通过 IPTables 访问它。我是个白痴。

标签: web-applications ssl nginx port


【解决方案1】:

为您的应用设置命名位置,并参考 try_files 指令中的位置:

server {
  location @app1 {
    ... (proxy/fcgi/sgci directives depending on what kind of app you're directing to)
  }

  location @app2 {
    ... (proxy/fcgi/sgci directives depending on what kind of app you're directing to)
  }

  location /app-path1/ {try_files @app1;}
  location /app-path2/ {try_files @app2;}
}

【讨论】:

  • 好的,我正在尝试这个,但我认为我在 location 下丢失了一部分,可以是 proxy_pass 吗?我究竟需要在哪里指向不同的端口?
【解决方案2】:

我们这样做的简单方法是为同一主机上的另一个端口添加另一个侦听行,因为它都是内部的。

它不起作用的原因是因为我将 IPTABLES 锁定并忘记了。

解决了。给您添麻烦了。

【讨论】:

    猜你喜欢
    • 2015-12-05
    • 2022-01-07
    • 1970-01-01
    • 1970-01-01
    • 2022-01-25
    • 1970-01-01
    • 2015-11-07
    • 2016-09-30
    • 1970-01-01
    相关资源
    最近更新 更多