I have various subdomains set up successfully as virtual hosts on my Digital Ocean Droplet. For some reason though, my latest subdomain is serving a different subdomain, and I'm not sure why. So if you go to selingo.mikeheavers.com
it services the contents of exhibitcolumbus.mikeheavers.com
. Furthermore, if you just enter my droplet's IP address, it serves exhibitcolumbus.mikeheavers.com
- I would expect it to just serve mikeheavers.com
. What have I mixed up?
I set both subdomains up through a .conf file and sudo a2ensite [file.com.conf]
This is the contents of selingo.mikeheavers.com.conf:
<VirtualHost *:80>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerAdmin mheavers@gmail.com
ServerName selingo.mikeheavers.com
ServerAlias www.selingo.mikeheavers.com
DocumentRoot /var/www/selingo/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel warn rewrite:trace8
RewriteEngine On
RewriteCond %{SERVER_NAME} =selingo.mikeheavers.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
and this is exhibitcolumbus.com.conf:
<VirtualHost *:80>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerName exhibitcolumbus.mikeheavers.com
ServerAlias www.exhibitcolumbus.mikeheavers.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/exhibitcolumbus/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel warn rewrite:trace8
RewriteEngine on
RewriteCond %{SERVER_NAME} =exhibitcolumbus.mikeheavers.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
I also noticed this in my /etc/hosts
file, and I'm not sure where the first entry came from - I don't remember setting it up:
127.0.1.1 extra extra
127.0.0.1 localhost
I'm also using letsencrypt for SSL, so possible that is causing issues? I saw that it created some conf files as well, but they are basically the same as above, with the addition of:
SLCertificateFile /etc/letsencrypt/live/exhibitcolumbus.mikeheavers.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/exhibitcolumbus.mikeheavers.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/exhibitcolumbus.mikeheavers.com/chain.pem
I also set up A Records for each subdomain on my droplet which point to my IP address (http://107.170.120.88/), which is weirdly also not serving up my primary domain (should be what you see at mikeheavers.com)
I see this when I enter apachectl -S
:
AH00112: Warning: DocumentRoot [/var/www/html] does not exist
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:443 is a NameVirtualHost
default server exhibitcolumbus.mikeheavers.com (/etc/apache2/sites-enabled/exhibitcolumbus.mikeheavers.com-le-ssl.conf:2)
port 443 namevhost exhibitcolumbus.mikeheavers.com (/etc/apache2/sites-enabled/exhibitcolumbus.mikeheavers.com-le-ssl.conf:2)
alias www.exhibitcolumbus.mikeheavers.com
port 443 namevhost mikeheavers.com (/etc/apache2/sites-enabled/mikeheavers.com-le-ssl.conf:2)
port 443 namevhost prototypes.mikeheavers.com (/etc/apache2/sites-enabled/prototypes.mikeheavers.com-le-ssl.conf:2)
*:80 is a NameVirtualHost
default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost exhibitcolumbus.mikeheavers.com (/etc/apache2/sites-enabled/exhibitcolumbus.mikeheavers.com.conf:1)
alias www.exhibitcolumbus.mikeheavers.com
port 80 namevhost mosaic.mikeheavers.com (/etc/apache2/sites-enabled/mosaic.mikeheavers.com.conf:1)
port 80 namevhost prototypes.mikeheavers.com (/etc/apache2/sites-enabled/prototypes.mikeheavers.com.conf:1)
port 80 namevhost selingo.mikeheavers.com (/etc/apache2/sites-enabled/selingo.mikeheavers.com.conf:1)
alias www.selingo.mikeheavers.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
How do I untangle whatever mess I made?