Can't find site or site lands on wrong host

If you find that going to your URL works (DNS resolves), but it shows the wrong site on your server (your default site, alphabetically, from /var/www/), and, letsencrypt says no such site, and, a2enablesite says, no such site... then it's quite simple. The config file is missing or wrong in /etc/apache2/

Possible problems:

1. Wrong permissions on the config file.

2. The config file is in sites-available but not sites-enabled

3. The config file is in sites-enabled but not sites-available

4. The config file does not have a filename ending in .conf (really!!!)

5. The folder containing HTML does not match the path given in the config file (/var/www/mysite)

If apache won't start at all

1. Your syntax in the config file is wrong.

It should look like this (assuming your site is mysite.co.za):

<VirtualHost *:80>

DocumentRoot /var/www/mysite

Options All Indexes ExecCGI

ServerName www.mysite.co.za

ServerAlias mysite.co.za

ErrorDocument 404 /error.html

</VirtualHost>


<VirtualHost *:443>

    DocumentRoot /var/www/mysite

    Options All Indexes ExecCGI FollowSymLinks

    ErrorDocument 404 /error.html

    ServerName www.mysite.co.za

    ServerAlias mysite.co.za

    Include  /etc/letsencrypt/options-ssl-apache.conf 

    SSLCertificateFile  /etc/letsencrypt/live/mysite.co.za/fullchain.pem 

    SSLCertificateKeyFile /etc/letsencrypt/live/mysite.co.za/privkey.pem 

</VirtualHost>

2. You have added a module to apache that doesn't work or isnt installed

3. You've specified an SSL entry (VirtualHost *443) but haven't actually generated the keys yet (install and run LetsEncrypt).

Popular posts from this blog

reduce email address harvesting

Setting the PHP version