Apache2 reverse proxy not working on Ubuntu 20.04.
sudo a2enmod proxy proxy_http proxy_balancer lbmethod_byrequests
Replaced sites-available/000-default.conf (only one enabled) as the following
<VirtualHost *:8080>
ProxyPreserveHost On
ErrorLog ${APACHE_LOG_DIR}/myproxy_error.log
CustomLog ${APACHE_LOG_DIR}/myproxy_access.log combined
ProxyPass / http://127.0.0.1:8081/
ProxyPassReverse / http://127.0.0.1:8081/
</VirtualHost>
Restart
sudo systemctl restart apache2
http://domain:8080
It still loads the apache default page, not proxy to http://127.0.0.1:8081/.
wget http://127.0.0.1:8081/
works.
No errors found in the logs.
$apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2022-06-14T13:30:55
Copyright Notice:Content Author:「eastwater」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73953662/apache2-reverse-proxy-not-working-on-ubuntu-20-04