I've got about 5 web applications on different servers running on my LAN, which are all listening to port 80

I would like to make them accessible from the internet by setting up an Apache reverse proxy on my main webserver, which is running on Ubuntu 16.04

Changing their ports and then portfordwarding is not a really good option, since there are a bunch of devices that would need reconfiguration. Plus I would like to keep it user friendly, manually writing ports isn't

So basically, I want to redirect requests the following way:

www.mydomain.com/server3 should redirect to

www.mydomain.com/server4 should redirect to

And so on

For now, I followed these instructions: https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension

After installing and enabling the requeried modules, I added the following lines to the `/etc/apache2/sites-enabled/000-default.conf' file:

<VirtualHost *:80>
ProxyPreserveHost On

# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass "/server3" ""
ProxyPassReverse "/server3" ""

ServerName pacs

But it didn't have any effect, same goes for this:

<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /
ProxyPassReverse /

ServerName pacs

Am I missing something?


The directive ProxyPass "/server3" "" does not need the default port number 80 for HTTP and I would add a trailing slash:
ProxyPass "/server3/" "

As of the the 2.4 release the manual recommends the functionally identical syntax with the ProxyPass directive enclosed in a <Location> directive:

<VirtualHost *:80>
     ServerName pacs
     <Location /server3/>
          ProxyPass ""
          ProxyPassReverse ""

after restarting requests to http://pacs/server3/ should now be forwarded to, check the access log there to see them come in.

Note: If the content on for instance refers to /css/style.css your browser will interpret that and make a request to http://pacs/css/style.css which most likely fails as that resource is not covered by the reverse proxy.

  • I think I misunderstood what "ServerName" actually stands for I'm running tests in a lan server, which doesn't have a domain name pointing to it. Right now I'm trying to forward requests from to Both leaving ServeName blank, and using the actual ip won't work. A reference to a .css doesn't seem to be the problem, as I tried changing to something like google.com with no luck
    – minusnine
    Jul 13 '16 at 13:40
  • Got it to work using as the servername, and typing 172.16.122/server3/ instead of 172.16.122/server3 I've got another problem going now, but that's a whole different story Thank you a lot!
    – minusnine
    Jul 13 '16 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.