Menu

Cannot get a Subdomain forward to a different port of parent IP

Virtualmin
2020-02-20
2020-02-21
  • Zeeshan Khan

    Zeeshan Khan - 2020-02-20

    I could do this really easily with cPanel earlier, but now that I migrated to Virtualmin, I just do not know how.

    If I have a site with domain www.mysite.com running on Webmin/Virtualmin, I just want a subdomain that can easily allow me to access the Virtualmin console.

    Currently I always have to type www.mysite.com:10000 to get to Webmin/Virtualmin

    I want to create a subdomain called webmin.mysite.com and this should automatically take me to www.mysite.com:10000

    On my external DNS service I've already created a CNAME record set for webmin.mysite.com which points to mysite.com (that was the way it was done in cPanel too).

    Now I need to configure Virtualmin somehow that whenever there is webmin.mysite.com in the URL, it will take me to www.mysite.com:10000

    Help appreciated, thank you!

     
  • Ilia

    Ilia - 2020-02-20

    Hi,

    You need to setup proxy, something like that:

    PROXY SETUP AS VIRTUAL-SERVER
    https://sourceforge.net/p/webadmin/discussion/600155/thread/6eb89f60/?limit=25

    /etc/webmin/config
    referer=webmin.DOMAIN.COM
    
    Apache SSL (/conf.d/ssl.conf) config (before closing virtualhost)
    <IfModule mod_proxy.c>
        RewriteEngine On
        ProxyRequests Off
        SSLProxyEngine On
        SSLProxyVerify None 
        SSLProxyCheckPeerCN Off
        SSLProxyCheckPeerName Off
        SSLProxyCheckPeerExpire Off
    
        ServerName host.WEBMIN.DOMAIN.COM:433
        ServerAlias webmin.DOMAIN.COM
        ServerAlias serverowner.WEBMIN.DOMAIN.COM
        ServerAlias reseller.WEBMIN.DOMAIN.COM
        ServerAlias systemowner.WEBMIN.DOMAIN.COM
        ProxyPass / "https://127.0.0.1:10000/"
        ProxyPassReverse / "https://127.0.0.1:10000/"
    
    
        <Location />
            Header always set X-Frame-Options SAMEORIGIN
            Header edit Location webmin.DOMAIN.COM:433 webmin.DOMAIN.COM
            Header edit Location serverowner.WEBMIN.DOMAIN.COM:433 serverowner.WEBMIN.DOMAIN.COM
            Header edit Location reseller.WEBMIN.DOMAIN.COM:433 reseller.WEBMIN.DOMAIN.COM
            Header edit Location systemowner.WEBMIN.DOMAIN.COM:433 systemowner.WEBMIN.DOMAIN.COM
        </Location>
    
    </IfModule>
    
     
  • Zeeshan Khan

    Zeeshan Khan - 2020-02-21

    Thanks very much, proxy seems to work, I searched a bit more on proxy and used the solution from here (bottom post): https://virtualmin.com/node/13580

    • Created a sub domain webmin.mydomain.com (for example)
    • In Server Configuration -> Edit Proxy Website set Proxying Enabled to Yes and write the Proxy to URL https://mydomain.com:10000
    • Select mydomain.com in Virtualmin and in Server Configuration -> Manage SSL Certificate -> Let's Encrypt -> Request certificate (if you don't have already a certificate for this domain)
    • In Server Configuration -> Manage SSL Certificate click the Copy to Webmin button to use mydomain.com certificate for webmin
    • In Webmin, Webmin -> Webmin Configuration -> Trusted referrers add mydomain.com and webmin.mydomain.com to the Trusted websites list

      **I'm having 2 problems still:** 1) If I just type "webmin.mydomain.com" in the browser, it doesn't work as it directs to just http and says problem with Cookies, however if I type "https://webmin.mydomain.com" it works

      2) Even when it works with https, the SSL certificate for the parent site is not used https://webmin.mydomain.com shows as not secure

     

    Last edit: Zeeshan Khan 2020-02-21

Log in to post a comment.

MongoDB Logo MongoDB