Ubuntu 13.10 uses apache 2.4, you should check all your apache configuration. But for this present case you should note that a2ensite
and a2dissite
commands won't be able to see your files in /etc/apache2/sites-available if it does not end with .conf
, so rename it to sites-available/cnm.conf
and run a2ensite cnm
.
Then your Virtualhost definition is certainly better with *:80
, it means this virtualhost is activated for all IP interfaces (*
) on port 80. cnm.localhost
or cnm
are not valid values here, only IP numbers (Ip of your apache server) or *
for all, and a port number.
Then check how you configuration is read by apache, running theses commands:
# load apache env
# be careful, there is a dot and a space
. /etc/apache2/envvars
# Check apache Virtualhosts config
apache2 -S
You should get something like:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server something (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost something (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost cnm (/etc/apache2/sites-enabled/cnm.conf:4)
If it is ok, and if you have the right Ip in your hosts file for cnm
, and you can test that with a ping, then using http://cnm/
should use the Virtualhost having cnm in the ServerName.
If you have an answer from the default Virtualhost then it means apache is not finding the name used in your Host header in the list of ServerName and ServerAlias available for that IP/port and fallbacks to the default Virtualhost. If you are really stuck (and you did not forgot to restart) you can always remove the default Virtualhost and keep only the one you are working on.