Apache's reverse proxy is an act of an
Apache webserver providing content from other webserver transparently. This is useful in many instances such as caching and mirroring, but it's mostly used to serve websites that are hosted behind NAT or a firewall. A reverse proxy server routes connection addressed to the internal server, and the client sees the reverse proxy server itself as the origin server.
Apache can be configured to serve URL's such as
http://www.example.com/webapp to actually get the content from
http://192.168.0.10/myapp, which is hosted from an internal network. This happens transparently and the user initially requesting
http://www.example.com/webapp need not to be aware of what happens in the background.
Apache require 2 modules enabled for this reverse proxy to work. These modules are
proxy_http. To enable them, run the following command at the terminal.
$ sudo a2enmod proxy_http Considering dependency proxy for proxy_http: Enabling module proxy. Enabling module proxy_http.
That will enable both
proxy module is actually a dependency to the
proxy_http module. This is confirmed by the output of the above command.
Once the module is enabled, you can start configuring the reverse proxy settings.
You'll need to add the following lines to your
Apache's configuration file.
Ubuntu, the file could be
ProxyRequests Off ProxyPass /webapp http://192.168.0.10/myapp ProxyPassReverse /webapp http://192.168.0.10/myapp
Apache will have to be restarted for the changes to work.
|Ubuntu 16.04 LTS (Xenial Xerus)|
|Ubuntu 16.10 (Yakkety Yak)|
|Ubuntu 17.04 (Zesty Zapus)|
|Ubuntu 17.10 (Artful Aardvark)|
|Ubuntu 18.04 LTS (Bionic Beaver)|
|Ubuntu 18.10 (Cosmic Cuttlefish)|
|Ubuntu 19.04 (Disco Dingo)|
Share your thoughts, suggest corrections or just say Hi. Login not required.