how-to
apache

apache

creating a virtualhost with reverse proxy

add library and enable modules

sudo apt-get install libapache2-mod-proxy-html
sudo a2enmod proxy proxy_http proxy_connect proxy_html xml2enc

restart

sudo service apache2 restart

add a new virtualhost file

sudo vim /etc/apache2/sites-available/site-proxy.conf
<VirtualHost *:80>
    ServerAdmin [email protected]
    ProxyRequests off
    DocumentRoot /var/www
    ProxyPreserveHost On
 
    # set the url used on live env
    ServerName example.com
 
    # if more than one url will be used,
    # add here one per line
    ServerAlias www.example.com
 
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
 
    # possible values: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel error
 
    <Location />
        # site url to be accessed
        ProxyPass http://internal.example.com:8444/
        ProxyPassReverse http://internal.example.com:8444/
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

add this virtualhost to apache

sudo a2ensite site-proxy

restart apache (again)

sudo service apache2 restart