Apache Port Proxy

前端 未结 2 1386
广开言路
广开言路 2020-12-24 02:27

I have a non-Apache server listening to port 8001 and Apache listening port 80. I want a certain virtual domain to actually be served by the non-Apache server over port 80.

相关标签:
2条回答
  • 2020-12-24 03:06

    I have a site hosted by apache on port 80. I also have a python web server listening on port 8880, which needed accessed via http://[mydomainname]/something. Using txyoji's answer, I got it working by simply adding a proxy pass to my virtual host definition like so:

    ProxyPass /something http://mydomainname:8880/something
    ProxyPassReverse /something http://mydomainname:8880/something
    

    UPDATE

    Depending your setup, an even better way to do this is to setup a proxy pass for a port on "localhost". I think it's a bit more clear what you're doing, plus more portable. Along with this, you don't have to even open up the firewall to that port! You can proxy pass locally to any port, so there is no reason to expose that to the outside world if you don't have to. Funnel everything through port 80 and have Apache always "run out in front". Then, you can just worry about the security of that.

    ProxyPass /something http://localhost:8880/something
    ProxyPassReverse /something http://localhost:8880/something
    
    0 讨论(0)
  • 2020-12-24 03:18

    ProxyPass * http://www.example.com:8001/

    star is only valid in a block. Forward slash is what you want.

    ProxyPass / http://www.example.com:8001/
    ProxyPassReverse / http://www.example.com:8001/
    

    The reverse proxy ensures that redirects sent by your port 8001 server are adjusted to the canonical name name of your proxy.

    The apache manual has some examples. http://httpd.apache.org/docs/2.0/mod/mod_proxy.html

    0 讨论(0)
提交回复
热议问题