I have an AWS virtual server, with ubuntu 14.04 and apache 2.4.7. I have two domain names (let's say name1.com and name2.com), and I wanted both them to point to the IP of the server, and that apache redirected automatically to the folders (lets say /var/www/html/name1 and /var/www/html/name2 ).
Both sites are avalaible under http://ip-server/name1
and http://ip-server/name2
.
I follow the usual instructions: In /etc/apache2/sites-available/
I copy 000-default.conf
to 001-name1.conf
. This is the content of the file:
<VirtualHost *:80>
ServerName name1.com
ServerAlias www.name1.com
DocumentRoot /var/www/html/name1
LogLevel error
ErrorLog ${APACHE_LOG_DIR}/name1.error.log
CustomLog ${APACHE_LOG_DIR}/name1.access.log combined
</VirtualHost>
Then I activate it with sudo a2ensite 001-name1.conf
, and restart apache with sudo service apache2 restart
.
But when I try http://name1.com
(in a new private-mode brownser to avoid cache), it still redirects me to the defect index.html
of apache.
When I run apache2ctl -S
I get:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server ip-x-x-x-x.eu-west-1.compute.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost ip--x-x-x-x.eu-west-1.compute.internal (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost name1.com (/etc/apache2/sites-enabled/001-name1.conf:1)
alias www.name1.com
The logs are empty, so I don't know what else to do. Any ideas?