I try to setup a virtual host besides the default localhost.
Whenever I try to call my virtual host http://test I get the default Apache2 Index file that sits in the directory of http://localhost. Furthermore apache returns this page still after disabling (a2dissite) both VirtualHost files an reloading apache (service apache2 reload).
What could go wrong that the virtual host is not working?
Configuration:
My directory structure is the following:
/var/www/html # Default localhost dir
/var/www/html7index.html # Apache2 default index
/var/www/test # HTML dir for the virtual host
/var/www/test/index.html # My “website”
Content of /etc/hosts:
127.0.0.1 localhost
127.0.1.1 Laptop
127.0.0.1 test
Directory content of /etc/apache2/sites-available:
000-default.conf
default-ssl.conf
test.conf
File 000-default.conf:
<VirtualHost localhost:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
File test.conf:
<VirtualHost test:80>
ServerAdmin test@localhost
ServerName test
NameVirtualHost test
ServerAlias test
DocumentRoot /var/www/test
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>