Table of Contents

, , ,

Proxying DNS name to local service

Enable apache modules first

  a2enmod proxy proxy_http

vhost configuration example for service running on port 8080

Part to be added:

<VirtualHost *:80>
    ServerName sub.example.com
    ProxyPreserveHost On
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
</VirtualHost>

Note: Put above in ssl configuration when redirecting to ssl ports. Note: If the first argument in ProxyPass directives ends with a trailing /, the second argument should also end with a trailing /, and vice versa. Otherwise, the resulting requests to the backend may miss some needed slashes and do not deliver the expected results.

Restart apache2

  systemctl restart apache2

Tested on

See also

References