Home  >  Q&A  >  body text

The front end is nginx listening to port 80, and the back end is apache listening to port 8080. How does apache determine that the request comes from nginx?

The front end is nginx listening to port 80, and the back end is apache listening to port 8080. How does apache determine that the request comes from nginx, not from the user requesting port 8080 of apache

仅有的幸福仅有的幸福2713 days ago611

reply all(3)I'll reply

  • 怪我咯

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

    Since nginx is used, why can users directly access port 8080 of apache? So isn't nginx bypassed?
    I guess you want to prevent users from directly accessing apache’s 8080 port? ?
    If it is a Linux server, you can use iptables to prevent external access to port 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
    You can refer to this article at http://blog.lifw.org/post/19180849

    reply
    0
  • 为情所困

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

    You can customize a special header through proxy_set_header in the ngnix configuration. The apache side judges this header to identify whether it is an ngnix request.

    reply
    0
  • 仅有的幸福

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

    No need to judge, you set which port it listens on, and it will handle incoming connections on that port. Other ports have nothing to do with it.

    reply
    0
  • Cancelreply