Help on Virtual Host

Help on Virtual Host

am 20.11.2007 13:43:14 von Le Souricier Gris

Hello everybody,

I want to create some virtual hosts on my web server so I add theses
lines to my httpd.conf :

NameVirtualHost 192.168.1.1


ServerAdmin me@mycompany.com
DocumentRoot /var/www/html
ServerName intranet.mycompany.com
ErrorLog logs/intranet-error_log



ServerAdmin me@mycompany.com
DocumentRoot /var/www/toto
ServerName toto.mycompagny.com
ErrorLog logs/toto-error_log



ServerAdmin me@mycompany.com
DocumentRoot /var/www/other
ServerName other.mycompagny.com
ErrorLog logs/scalpel-error_log



When I Open my Internet Navigator on http://intranet.mycompany.com,
I've got the web site toto.mycompagny.com !!!

When I Open my Internet Navigator on http://other.mycompany.com,
That's ok

When I Open my Internet Navigator on http://toto.mycompany.com, That's
ok

I don't undestand !

Thanks for you help.

Re: Help on Virtual Host

am 20.11.2007 15:59:40 von Le Souricier Gris

On 20 nov, 13:43, Le Souricier Gris wrote:
> Hello everybody,
>
> I want to create some virtual hosts on my web server so I add theses
> lines to my httpd.conf :
>
> NameVirtualHost 192.168.1.1
>
>
> ServerAdmin m...@mycompany.com
> DocumentRoot /var/www/html
> ServerName intranet.mycompany.com
> ErrorLog logs/intranet-error_log
>

>
>
> ServerAdmin m...@mycompany.com
> DocumentRoot /var/www/toto
> ServerName toto.mycompagny.com
> ErrorLog logs/toto-error_log
>

>
>
> ServerAdmin m...@mycompany.com
> DocumentRoot /var/www/other
> ServerName other.mycompagny.com
> ErrorLog logs/scalpel-error_log
>

>
> When I Open my Internet Navigator onhttp://intranet.mycompany.com,
> I've got the web site toto.mycompagny.com !!!
>
> When I Open my Internet Navigator onhttp://other.mycompany.com,
> That's ok
>
> When I Open my Internet Navigator onhttp://toto.mycompany.com, That's
> ok
>
> I don't undestand !
>
> Thanks for you help.

Ok I find my mistake
http://httpd.apache.org/docs/2.0/vhosts/examples.html

J'ai trouv=E9 en effet j'avais vraiment mal =E9crit, httpd -S m'a bien
aid=E9 et j'ai utilis=E9 le lien HTML dans le fichier de conf de Apache
(RTFM je me l'applique) :

#
# Use name-based virtual hosting.
#
NameVirtualHost *
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.


ServerAdmin eric.berthomier@justice.fr
DocumentRoot /var/www/html
ServerName intranet.macompagnie.com
ErrorLog logs/intranet-error_log



ServerAdmin eric.berthomier@justice.fr
DocumentRoot /var/www/scalpel
ServerName scalpel.macompagnie.com
ErrorLog logs/scalpel-error_log



ServerAdmin eric.berthomier@justice.fr
DocumentRoot /var/www/webstat
ServerName webstat.macompagnie.com
ErrorLog logs/webstat-error_log