LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   virtual hosts (https://www.linuxquestions.org/questions/linux-software-2/virtual-hosts-177700/)

snu 05-04-2004 08:19 AM

virtual hosts
 
I searched for the answer, but perhaps i am too blind to find it.
Hope you can help me.
I have got one Domain and one IP

I want to have my normal domain and a virtual domain
something like this

domain.com

foo.domain.com

So I configured Apache

<VirtualHost *:80>
Servername domain.com
ServerAdmin webmaster@domain.com
ScriptAlias /cgi-bin/ /var/www/webmaster/cgi-bin/
DocumentRoot /var/www/webmaster/html/
</VirtualHost>


<VirtualHost *:80>
Servername foo.domain.com
ServerAlias pictures
ServerAdmin webmaster@domain.com
ScriptAlias /cgi-bin/ /var/www/webmaster/cgi-bin/
DocumentRoot /var/www/webmaster/html/foo/
</VirtualHost>

When i start apache i get this

Starting httpd: [Tue May 04 15:17:53 2004] [warn] _default_ VirtualHost overlap on port 80, the first has precedence

Yes I use the same port for both. But how to change it? The other configuration is o.k i get the right website by comment the other other out.
Please help.

iluvatar 05-04-2004 08:43 AM

maybe it's about directory overlap?
"DocumentRoot /var/www/webmaster/html/foo/"
is inside the
"DocumentRoot /var/www/webmaster/html/"
wich means if you go to foo.domain.com you end up on domain.com/foo. I don't have much experience with virtual servers but maybe you should create real seperate directories for both?

greetz,
.-=~ iluvatar ~=-.

snu 05-04-2004 09:18 AM

No it wasn t but thanx

bentman78 05-04-2004 10:57 AM

post the last part of your conf file.

snu 05-04-2004 11:03 AM

That is the last part that is not comment out
I wrote

<VirtualHost *:80>
Servername domain.com
ServerAdmin webmaster@domain.com
ScriptAlias /cgi-bin/ /var/www/webmaster/cgi-bin/
DocumentRoot /var/www/webmaster/html/
</VirtualHost>


<VirtualHost *:80>
Servername foo.domain.com
ServerAlias pictures
ServerAdmin webmaster@domain.com
ScriptAlias /cgi-bin/ /var/www/webmaster/cgi-bin/
DocumentRoot /var/www/webmaster/html/foo/
</VirtualHost>



That is the example that is at the end
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

bentman78 05-04-2004 12:49 PM

is this in there anywhere?

NameVirtualHost *:80

should be right above your virtual hosts containers

bentman78 05-04-2004 12:53 PM

also look at your server name. The first one lists your domain name. It needs to have a FQDN. you just have domain.com. You need to give it a name. like www.domain.com.
The next one can be foo.domain.com or whatever you want to call it. Be sure to update your hosts file with the new server names as well, and give them the ip address of the ethernet connection.

snu 05-04-2004 02:13 PM

Thanx a lot.
NameVirtualHost *:80 was the error. It was commented out. I put
NameVirtualHost Mydomain.de:80
and it fits.
Thanx to everyone for help


All times are GMT -5. The time now is 09:58 AM.