Reverse proxy from the VPS to local server within VPN

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.5
Virtualmin version 7.50.0 GPL

Hello everyone

I wish to tell to the Virtual server under the VPS to reverse to my local server under the already established VPN.

As the VPS represents also the VPN server with ip 10.0.0.1 I want it to connect to the local server with ip 10.0.0.6 once I request the public DNS from the browser e.g. mylocalserver.duckdns.org and get the Webmin login page under the address mylocalserver.duckdns.org:10000 where it actually should be active the ip 10.0.0.6.

I tried so many times but I can’t get how to do it:

Obviously I am testing with my personal pc at home which is a client connected with that VPN with the ip 10.0.0.2.

Hope someone can assist!.

Thank you in advance.

I got it!

Just three steps:

  1. Create a Virtual host (not a Virtual server!) on port 443 on the VPS:
<VirtualHost ipv4 [ipv6]:443>
    ServerName admin.myhomeserver.duckdns.org

    # --- SSL SELF-SIGNED ---
    SSLEngine on
    SSLCertificateFile /etc/ssl/selfsigned/webmin.crt
    SSLCertificateKeyFile /etc/ssl/selfsigned/webmin.key

    # Prevent certbot from going through the proxy
    ProxyPass /.well-known !

    # SSL
    SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

    # Logging (optional)
    ErrorLog /var/log/apache2/webmin-proxy_error.log
    CustomLog /var/log/apache2/webmin-proxy_access.log combined

    # --- REVERSE PROXY ---
    ProxyPreserveHost On
    ProxyPass "/" "http://10.0.0.6:10000/"
    ProxyPassReverse "/" "http://10.0.0.6:10000/"
</VirtualHost>
  1. on the local server, go to Webmin ConfigurationSSL Encryption (SSL Settings tab) and disable Enable SSL and Enforce SSL:

  1. and then go back to Webmin ConfigurationTrusted Referrers and fill the Trusted websites box with the DNS chosen at step 1):

Once done, you can have the proxy reverse from the VPS to the local server within your VPN by comfortably typing on the browser your url:

That’s all folks! :nerd_face:

1 Like

thanks for the detailed post, it will definately be helpful. I will need to setup some proxiny before long, so it will help me.

1 Like