Flemming Lemche Flemming Lemche - 3 months ago 15
Apache Configuration Question

Apache Virtual Host doesn't work

I'm trying to get Apache Virtual Host to work but it wont catch the domains and goes out on the internet instead.

I've enabled the Virtual Host in the Config file:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf


My httpd-vhosts.conf file looks like this:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "//nas/Web Design/Sites"
</VirtualHost>


<VirtualHost *:80>
ServerAdmin webmaster@fdn.dk
DocumentRoot "//nas/Web Design/Sites/Fdn"
ServerName fdn.dk
ServerAlias www.fdn.dk
ErrorLog "logs/fdn/error.log"
CustomLog "logs/fdn/access.log" common
</VirtualHost>


http://Localhost works fine but when i type fdn.dk or www.fdn.dk the browser tries to find the site on the internet instead of looking at my local folder.

What is wrong...??
I tried to find a solution on the internet but without luck.

Do I need to change something in the host file ???

Kind Regards
Flemming

Answer

Yes, you need to add that domain name to /etc/hosts file if you are using an operating system that has it. Or to C:\WINDOWS\system32\drivers\etc\hosts if you are using Windows.

Example of record: 127.0.0.1 www.fdn.dk

Comments