Heim  >  Fragen und Antworten  >  Hauptteil

Das Front-End ist Nginx, das Port 80 überwacht, und das Back-End ist Apache, das Port 8080 überwacht. Wie stellt Apache fest, dass die Anfrage von Nginx kommt?

Das Front-End ist Nginx, das Port 80 überwacht, und das Back-End ist Apache, das Port 8080 überwacht. Wie stellt Apache fest, dass die Anfrage von Nginx kommt und nicht vom Benutzer, der Port 8080 von Apache anfordert

仅有的幸福仅有的幸福2713 Tage vor610

Antworte allen(3)Ich werde antworten

  • 怪我咯

    怪我咯2017-05-16 17:03:08

    既然用了nginx,为啥用户还可以直接访问apache的8080端口呢?那nginx不是被绕过了嘛?
    我猜你是想不让用户直接访问apache的8080端口??
    如果是Linux服务器的话可以使用iptables禁止外面访问8080端口,
    iptables -t filter -A INPUT -p tcp -m tcp --dport 8080 -s localhost -j ACCEPT
    iptables -t filter -A INPUT -p tcp -m tcp --dport 8080 -j REJECT
    可以参考下http://blog.lifw.org/post/19180849这篇文章

    Antwort
    0
  • 为情所困

    为情所困2017-05-16 17:03:08

    可以在 ngnix 配置中通过 proxy_set_header 自定义一个特殊的头,apache 端通过判断这个头来识别是否是 ngnix 的请求。

    Antwort
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 17:03:08

    不用判断啊,你设置它监听哪个端口,他就处理那个端口传入的连接。别的端口和它没关系。

    Antwort
    0
  • StornierenAntwort