[Solved] [Local Cache issue] Non-www website redirects to ispconfig panel

Discussion in 'Installation/Configuration' started by JustMeh, Feb 22, 2021.

  1. JustMeh

    JustMeh New Member

    I stumbled upon an issue where my non-www website redirects to ispconfig's loginpage / control panel. https : // www . domain . com and http : // www . domain . com works as expected.
    [Edit] Note: Please ignore the spaces found in links. I broke down links using spaces as I was not allowed to make a post with any links.

    The issue started after I tried to secure my ispconfig:8080 control panel with https. I followed a few other guides in the forum and ended up editing apache2's ispconfig.vhost file (Changes in BOLD):
    Code:
    #Listen 8080
    #NameVirtualHost *:8080
    
    <VirtualHost *:443>
      ServerAdmin webmaster@localhost
      ServerName lmsserver . verconsult . co . za
    
      Alias /mail /var/www/ispconfig/mail
    .....
    </VirtualHost>
    I checked the website's vhost file for "not mixing IPs and *" and found the following:
    Code:
    <VirtualHost *:80>
    
          ServerName iopsatraining . co . za
          ServerAlias www . iopsatraining . co . za
    ....
    RewriteCond %{HTTPS} off
                    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
    ....
    </VirtualHost>
    
    <VirtualHost *:443>
    
           ServerName iopsatraining . co . za
           ServerAlias www.iopsatraining . co . za
    ....
    </VirtualHost>

    Currently I only have 1 website hosted on the server, this website has www. autosubdomain, SSL, LetsEncrypt SSL, http => https redirect, and no-www => www redirect (I might've disabled this one) enabled. All of which was done via the control panel.

    apache2ctl -S results in:
    Code:
    VirtualHost configuration:
    *:80                   is a NameVirtualHost
             default server lmsserver . verconsult . co . za (/etc/apache2/sites-enabled/000-default.conf:1)
             port 80 namevhost lmsserver . verconsult . co . za (/etc/apache2/sites-enabled/000-default.conf:1)
             port 80 namevhost iopsatraining . co . za (/etc/apache2/sites-enabled/100-iopsatraining.co.za.vhost:7)
                     alias www . iopsatraining . co . za
    *:443                  is a NameVirtualHost
             default server lmsserver . verconsult . co . za (/etc/apache2/sites-enabled/000-ispconfig.vhost:9)
             port 443 namevhost lmsserver . verconsult . co . za (/etc/apache2/sites-enabled/000-ispconfig.vhost:9)
             port 443 namevhost iopsatraining . co . za (/etc/apache2/sites-enabled/100-iopsatraining.co.za.vhost:125)
                     alias www . iopsatraining . co . za
    ServerRoot: "/etc/apache2"
    Main DocumentRoot: "/var/www/html"
    Main ErrorLog: "/var/log/apache2/error.log"
    Mutex fcgid-proctbl: using_defaults
    Mutex ssl-stapling: using_defaults
    Mutex proxy: using_defaults
    Mutex ssl-cache: using_defaults
    Mutex default: dir="/var/run/apache2/" mechanism=default
    Mutex mpm-accept: using_defaults
    Mutex fcgid-pipe: using_defaults
    Mutex watchdog-callback: using_defaults
    Mutex rewrite-map: using_defaults
    Mutex ssl-stapling-refresh: using_defaults
    PidFile: "/var/run/apache2/apache2.pid"
    Define: DUMP_VHOSTS
    Define: DUMP_RUN_CFG
    Define: MODPERL2
    Define: ENABLE_USR_LIB_CGI_BIN
    User: name="www-data" id=33
    Group: name="www-data" id=33
    
    I tried a few things but I only seem to make things worse. I am a newby or beginner to linux hosting.
    Can anyone point out what I did wrong?
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Never modify the vhost files manually, as it can break things and changes will be overwritten.

    To reset the ISPConfig vhost, run a forced update and reconfigure services:
    Code:
    ispconfig_update.sh --force
    You can set up a proxy to have the panel on port 443, though having it on a separate port is better in some cases.
     
  3. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

  4. JustMeh

    JustMeh New Member

    I was a local dns issue, or the issue does not occur on mobile devices.
    I spent so much time on this... Thank you for the support.

    Ipconfig /flushdns should clear up this issue right? <- [edit] Running this in CMD fixed my issue.
    I hope this saves someone else a lot of time and effort
     
    Last edited: Feb 23, 2021
  5. JustMeh

    JustMeh New Member

    I dont like editing them either, that is why i only touched the ispconfig.vhost.

    I did not see a method to change the port (other than the initial setup). I tried to force an update so that i could reconfigure the port, but i did not see the option appear? (i might be mistaken).
     
  6. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    This option is shown. But you could also set up a web and use that as proxy for your panel on port 8080.
     

Share This Page