I've rented a small virtual private server that runs Ubuntu, and I'm trying to configure a sub-domain. Thanks to several resources I've figured out how I'm supposed to do this, but still it does not work at all.
Hopefully someone can help me find out what I've done wrong.
I've created a file called <domain>.conf
in /etc/apache2/sites-available
. It contains the following:
NameVirtualHost *:80
# Configuration for index.<domain> and <domain>.
<VirtualHost *:80>
ServerAdmin administrator@<domain>
DocumentRoot /var/www/sites/<domain>/index
ServerName index.<domain>
ServerAlias <domain>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I've enabled the website using following command:
sudo a2ensite /etc/apache2/sites-available/<domain>.conf
Furthermore I've configured the DNS settings as following:
Name Type Value
<domain> A <ip-address>
index.|DOMAIN| A <ip-address>
Opening http://<domain>
works perfectly fine but opening http://index.<domain>
does not. Instead I get a message telling me that "This web page is not available".
apache2ctl -S
returns the following:
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:
*:80 is a NameVirtualHost
default server localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost index.<domain> (/etc/apache2/sites-enabled/<domain>.conf:4)
alias <domain>
dig index.example.com
return the correct IP?apache2ctl -S
should show what apache's idea of the virtualhosts is.<domain>. 10800 IN SOA <nameserver>. hostmaster.<domain>. 2015022700 14400 3600 1209600 86400