Weird apache issue, site http fails but https works

Discussion in 'Installation/Configuration' started by snowfly, May 12, 2016.

  1. snowfly

    snowfly Member

    Got a weird apache issue I'm not sure how to fix.
    ISPConfig 3.0.5.4p9, Apache/2.4.10, Debian Jessie, running a master server, and multiple other web servers.

    On the master server, the server hostname is cp.example.com, in ISPConfig the server is shown as cp.example.com, and I have a web site added via ISPConfig called 'cp.example.com'. (so all using the same domain)

    Now this website only works when accessing via https, e.g. https://cp.example.com, correctly showing content from the Document Root of that virtual site (e.g. /var/www/cp.example.com/web)
    BUT, when trying to access via http, e.g. http://cp.example.com, the default Document Root is served up, e.g. /var/www , which suggests its not matching the virtualhost for port 80, and just using the apache 000-default.conf file.

    Any tips on how I can debug and fix?

    I checked the apache conf file for the site that ISPConfig generated (/etc/apache2/sites-enabled/100-cp.example.com.conf), and it seems to correctly have VirtualHost *:80, and ServerName matches cp.example.com
     
  2. snowfly

    snowfly Member

    Just an update, one 'hack' I can do to work around this for now, is create a php file /var/www/index.php, and use the following to redirect to the https version of the site that works.
    Not ideal, still keen to find the real cause and get it fixed.

    <?php
    if ($_SERVER['HTTP_HOST']=='cp.example.com') {
    header("Location: https://cp.example.com");
    exit;
    }
    ?>
     

Share This Page