Apache reverse proxy (or gateway) helps to balance load among several back-end servers.
As a result, it improves the performance of the websites for faster communication.
But, wrong reverse proxy setup can result in website failure.
At Bobcares, we often get requests from our customers to configure the “Webmin Apache reverse proxy” as part of our Server Management Services.
Today, we’ll see how our Support Engineers configure Apache reverse proxy in Webmin and fix the related errors with it.
How we configure Apache reverse proxy in Webmin
Let’s see how our Support Engineers set up Apache reverse proxy in Webmin control panel.
Here are the steps we execute to configure Apache reverse proxy.
1. First, we login to Webmin, and go to Webmin > Servers > Apache Webserver > Global configuration > Configure Apache Modules.
2. Then, we mark the checkbox for the mod_proxy module.
3. And we click the Enable Selected Modules button.
4. Next, we navigate to Global Configuration > Edit Config Files.
5. In Edit Directives in File, we choose /etc/httpd/conf/httpd.conf & added the virtual host block like this.
<VirtualHost *:80> ServerName webmin.yourdomain.com ProxyPass / http://localhost:10000/ ProxyPassReverse / http://localhost:10000/ </VirtualHost>
6. After that in /etc/webmin/config file, we add the line referer=webminhostname.
7. Finally, we restart the service to apply the changes.
service httpd restart
The proxy settings interface of a Webmin virtualhost look as shown below.
Common issues after setting Apache reverse proxy in Webmin
From our experience in managing servers, we’ve seen customers facing different kinds of problems with Apache reverse proxy in Webmin.
Let’s see how our Support Team solved common errors.
1. Wrong setting in Webmin configuration file
Recently, one of our customers reported us with a problem regarding the Apache reverse proxy. When he tried to access Webmin on the browser, it resulted in an error like “503 Service Temporarily Unavailable”
So, to solve this error we took the following steps.
1. First, we checked the error log /var/log/apache2/error.log.
2. By analyzing, we found that the HTTP connection was disabled.
3. Then, we checked Webmin configuration file /etc/webmin/miniserv.conf.
4. Webmin normally runs as https with a self-generated certificate. So, to use HTTP we disabled ssl value ie.,
ssl=0
5. And then we restarted the services to reflect the changes made in the configuration file.
/etc/init.d/apache2 restart
/etc/init.d/webmin restart
This allowed users to access URL without any failure.
2. Misconfiguration of Apache file
Similarly, another customer reported us that after setting Apache reverse proxy & when he tried to access “https://webmin.example.com“, it resulted in an “internal server error (500)”.
Our Support Engineers took the following steps to solve the issue.
1. First, we checked the error log /var/log/apache2/error.log to verify the problem.
2. Next, we opened Apache configuration file /etc/httpd/conf/httpd.conf.
3. We found the following entry under the Virtual host.
ServerName webmin.example.com
ServerAlias webmin.example.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
4. In this case, ServerAlias & ServerName are same, so removed that part. Also, we omitted the proxy part because by default the user will have access granted.
5. So, we corrected them like this:
ServerName webmin.example.com
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/server.pem
SSLCertificateKeyFile /etc/apache2/ssl/server.key
SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / https://127.0.0.1:10000/
ProxyPassReverse / https://127.0.0.1:10000/
6. Then, we logged in to Webmin & navigated to Webmin > Servers > Apache Webserver > Global configuration > Configure Apache Modules.
7. And enabled the Apache modules mod_ssl, mod_proxy, mod_proxy_http.
8. Finally, we restarted the services to reflect the changes made.
That fixed the problem. Now, the user could access the Webmin URL without any failure.
[Having trouble after setting Apache reverse proxy in Webmin? We’ll fix it for you.]
Conclusion
In short, to improve website performance & to load balance between client & server setting Apache reverse proxy is a good practice. Today, we saw how our Support Engineers configured Webmin Apache reverse proxy and fixed the common errors.
If your reverse proxy setup takes you to the default website you may try disabling cloudflare.
I’ve got no access to the content of the webmin folder after login. No images displayed pr sripts loaded.
I’m on a bind FQDN with wy 2 NS sevrvers running webmin and ns1 running apache. I’m running a desktop interface on ns2 to get a webmin access to all my wireguard VPN hosts (servers included).
the main page of apache list the avialable hosts as a link hostname.FQDN.xxx and redirect it with apache to the same address:webmin port.
I think something is wrong with Webmin and the proxysettings. Let’sencrypt for my domain has run for all correctly.
I could access all the webmin hosts localy before trying to setup the proxy to ssl the all domain for webmin hosts.
Hi,
Please contact our support through live chat(click on the icon at right-bottom).