Apache reverse proxy on Ubuntu
Install Apache and Enable relevant Apache proxy modules
sudo apt-get install apache2
sudo a2enmod proxy proxy_http
Create new configuration file for the virtual host in /etc/apache2/sites-available.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerAlias www.example.org
ServerName example.org
ErrorLog /var/log/apache2/example-error.log
LogLevel info
CustomLog /var/log/apache2/example-access.log combined
ProxyPreserveHost On
ProxyRequests off
# Allow from everywhere
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# Send all requests to port 1122
ProxyPass / http://localhost:1122/
ProxyPassReverse / http://localhost:1122/
</VirtualHost>
Link the created configuration file to sites-enabled. The numbers in target name are there to guarantee the files get loaded in certain order (Apache scans the sites-enabled folder and loads all configuration files).
ln -s /etc/apache2/sites-available/example \
/etc/apache2/sites-enabled/001-example
Restart Apache (since we changed modules, otherwise reload would be enough)
sudo service apache2 restart