user1811829
user1811829

Reputation:

Apache - virtualhost - works only one

I need a couple of virtualhosts on my local dev machine. Unfortunately it needs to be windows.

httpd-vhost.conf

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot "C:/xampp/htdocs"
  ServerName localhost
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin [email protected]
   DocumentRoot "C:/xampp/htdocs/manadom.local/public"
   ServerName manadom.local
   ErrorLog "logs/manadom.local-error.log"
   CustomLog "logs/manadom.local-access.log" combined
</VirtualHost>

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot "C:/xampp/htdocs/galeriabiznesu"
  ServerName gb.loc
  ErrorLog "logs/gb.loc-error.log"
  CustomLog "logs/gb.loc-access.log" combined
</VirtualHost>

And hosts file:

127.0.0.1 localhost
127.0.0.1 manadom.local
127.0.0.1 gb.loc

The problem is: localhost points to

C:/xampp/htdocs/manadom.local/public

manadom.local points to

C:/xampp/htdocs/manadom.local/public too

gb.loc points to

C:/xampp/htdocs/manadom.local/public

I can't idea what's wrong?

Please help me, i'm not an admin but i read about it lot and i don't know what possibly i can do wrong.

Upvotes: 2

Views: 5208

Answers (2)

Glasnhost
Glasnhost

Reputation: 1135

Yes, as said, before virtual hosts directives you should have:

NameVirtualHost *:80

Upvotes: 3

Krzysztof Księżyk
Krzysztof Księżyk

Reputation: 1379

For named virtual hosts you have to set "NamedVirtualHosts" directive. Please look at the manual -> http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost

Upvotes: 3

Related Questions