Follow the steps to install and configure apache as a reverse proxy.
1. Install apache2
sudo apt-get update; sudo apt-get upgrade; sudo apt-get install apache2
2. Enable apache2 modules
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
3. Update apache2 default configuration file
sudo vi /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Multiple hosts:
4. Restart the apache2 server
sudo systemctl restart apache2
1. Install apache2
sudo apt-get update; sudo apt-get upgrade; sudo apt-get install apache2
2. Enable apache2 modules
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
3. Update apache2 default configuration file
sudo vi /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Multiple hosts:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /web http://localhost:8080/web
ProxyPassReverse /web http://localhost:8080/web
ProxyPass /micro http://localhost:8081/micro
ProxyPassReverse /micro http://localhost:8081/micro
#ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
4. Restart the apache2 server
sudo systemctl restart apache2
No comments:
Post a Comment