You are not logged in.
Hello,
I'm trying to configure my apache server to have more than a site at the same time.
my httpd.conf
with
...
ServerName localhost
<VirtualHost *:80>
ServerName test
DocumentRoot /srv/http/test
<Directory /srv/http/test>
Options FollowSymLinks MultiViews
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName wiki
DocumentRoot /srv/http/wiki
<Directory /srv/http/wiki>
Options FollowSymLinks MultiViews
Order allow,deny
allow from all
</Directory>
</VirtualHost>
...both "test" and "wiki" are in my /etc/hosts but if I go to http://localhost, http://test or http://wiki, I arrive on the same page : the index.html in /srv/htpp/test
Why only the first one ?
Thank you
Last edited by martvefun (2010-05-22 09:21:52)
English is not my native language, sorry for the mistakes
Arch amd64, GNOME, Thinkpad
Offline
Did you try usins http://localhost/wiki and http://localhost/test ?
Offline
If what you are trying to do is serve more than one site under only 1 ip, you either need to serve it under a directory as n0dix suggested (http://localhost/test ...etc), use a different port or bind virtualhosts to different domains. I am not sure if /etc/hosts entries would count as different domains
You might need to setup a local dns server but it might as well be over kill. You should probably start reading read http://httpd.apache.org/docs/2.0/vhosts/examples.html if you haven't already. Don't take my words as a fact though, i am not a professional admin nor have experiance so might be wrong.
Edit: After some reasearch apperantly /etc/hosts should work as well ... no clue, sorry can't help
Edit 2: I just saw that you might need to set "UseCanonicalName Off" to make apache get the servernames from request headers.
Last edited by kermana (2010-05-12 16:25:47)
Offline
/etc/hosts should work since the HTTP request will come to the server with a "Host: wiki" (for example) header.
You need to put "NameVirtualHost *:80" above your VHost definitions though.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Here's how I have my name based hosts set up (about 15 different sites for this server):
NameVirtualHost *:80
#
#
#
#
<VirtualHost *:80>
ServerAdmin webmaster@mysite.com
DocumentRoot /home/mysite/mysite.com
ServerName mysite.com
ServerAlias www.mysite.com
ErrorLog /var/log/httpd/mysite.com/error_log
CustomLog /var/log/httpd/mysite.com/access_log combined
</VirtualHost>
# other entries below this one.It looks as if your issue is the lack of the "NameVirtualHost" as fukawi2 states.
Offline
Yes thanks it works ![]()
English is not my native language, sorry for the mistakes
Arch amd64, GNOME, Thinkpad
Offline