How can I rewrite a Website(domain) or Subdomain to ispconfig.paneladress:8080 ?

Discussion in 'General' started by cassola-enterprises, Jul 26, 2016.

  1. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Using example domain names/ports, what exactly are you trying to accomplish? Eg. make https://cp.domain.com/ function as the ispconfig control panel, which is actually running on port 8080 (so the url looks nicer, without just redirecting to the port 8080 url)?
     
  2. Thanks for answering jesse, yes that is what I want to accomplish to make it prettier.
    Once you enter the "normal" domain the ugly one with the port can still come up, just that it is easier to type and remember for my clients and me of course. :)
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    There is no manual configuration in the apache config files required. Just add a subdomain "cp" to the website domain.tld and put the target URL e.g. https://domain.tld:8080 in the redirect field of this subdomain.
     
    cassola-enterprises likes this.
  4. Thank you very much!
     
  5. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    That redirect does work function-wise; if you want to keep the nicer https://cp.domain.tld/ url displaying then instead of redirecting you would proxy the connection on the back end. There's a more comprehensive example at https://www.howtoforge.com/community/threads/3-1-update-reverse-proxypass-apache.73210/#post-344465, but the parts you'd need for just the 'cp' subdomain are this (using debian jessie file locations/commands):

    Enable proxy module and create a server-wide apache .conf file:
    Code:
    # cat >/etc/apache2/conf-available/proxy_requests_off.conf <<EOF
    <IfModule mod_proxy.c>
        ProxyRequests Off
    </IfModule>
    EOF
    
    # a2enmod proxy
    # a2enmod proxy_http
    # a2enconf proxy_requests_off
    
    And put this in the apache directives for the cp.domain.tld website:
    Code:
        <If "%{HTTPS} == 'on'">
            SSLProxyEngine on
            <IfModule mod_proxy.c>
                ProxyRequests Off
                ProxyPreserveHost On
                ProxyPass /webmail "!"
                ProxyPass /roundcube "!"
                ProxyPass /squirrelmail "!"
                ProxyPass /phpmyadmin "!"
                ProxyPass / https://127.0.0.1:8080/
                ProxyPassReverse / https://127.0.0.1:8080/
            </IfModule>
        </IfModule>
    
    Note the above is untested (the example in that other post I linked above is tested code). That should also let you easily use a letsencrypt certificate for cp.domain.tld by enabling the checkbox for it.

    I've been planning to write somthing along those lines into a little howto here on howtoforge, as it's a nice solution for resellers to access a shared control panel through their own domain name, though I don't have an equivalent nginx example to go with it.
     
  6. Thank you!

    @till
    Wouldn't it be nice to pick a FQDN in the ispconfig 3.1 install script that then would serve as the panel domain with automatic letsencrypt installation?
    Because giving my clients a schooling in how to access "unsafe" websites in their browser is shurely not to their liking ;)
     

Share This Page