PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > VirtualHost issu
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

VirtualHost issu

Réponse
 
LinkBack Outils de la discussion
Vieux 31/01/2007, 21h42   #1
schneider
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut VirtualHost issu

Hello,

I have an Apache (2.0) server runing on a windows platform and I would
like to have two virtualhost.

The httpd.conf is :
__________________________________________________ ___________________________
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# 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.
#

<VirtualHost *:80>
DocumentRoot "c:/www/phpMyAdmin"
ServerName phpMyAdmin
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "c:/www/chemicalsourcing"
ServerName chemical-sourcing.com
</VirtualHost>
__________________________________________________ _________________________

When I use my browser to open the site chemical-sourcing.com, I have the
phpMyAdmin windows.
If I modify this httpd file by inverting the 2 virtualhost, then I had
the desired page openning.

Can you me : I don't understant why I have these results.
Thanks,
Jean-Marie
  Réponse avec citation
Vieux 01/02/2007, 08h43   #2
Davide Bianchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

On 2007-01-31, schneider <schneider.jm@free.fr> wrote:
> NameVirtualHost *:80
>
><VirtualHost *:80>
> DocumentRoot "c:/www/phpMyAdmin"
> ServerName phpMyAdmin
></VirtualHost>
>
><VirtualHost *:80>
> DocumentRoot "c:/www/chemicalsourcing"
> ServerName chemical-sourcing.com
></VirtualHost>


fine so far.

> When I use my browser to open the site chemical-sourcing.com, I have the
> phpMyAdmin windows.


How do you 'open' the site? Do you have a DNS or an entry in your hosts
file that 'point' the servername to the IP of your machine? If you
PING 'chemical-sourcing.com' do you get an answer?

> Can you me : I don't understant why I have these results.


This result is usually due to the fact that Apache can't understand from
your HTTP request which VHost you want, so it just 'serve' the first in
the list (unless you have one marked as 'default'). The problem is how
you send your request.

Davide

--
Unix admin is 99% of the time a well paid excuse to do bugger all,
1% of the time you earn every penny. Just like airline pilots.
--someone on comp.os.linux.misc
  Réponse avec citation
Vieux 01/02/2007, 10h02   #3
schneider
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

Davide Bianchi wrote:
> On 2007-01-31, schneider <schneider.jm@free.fr> wrote:
>
>>NameVirtualHost *:80
>>
>><VirtualHost *:80>
>>DocumentRoot "c:/www/phpMyAdmin"
>>ServerName phpMyAdmin
>></VirtualHost>
>>
>><VirtualHost *:80>
>>DocumentRoot "c:/www/chemicalsourcing"
>>ServerName chemical-sourcing.com
>></VirtualHost>

>
>
> fine so far.
>
>
>>When I use my browser to open the site chemical-sourcing.com, I have the
>> phpMyAdmin windows.

>
>
> How do you 'open' the site? Do you have a DNS or an entry in your hosts
> file that 'point' the servername to the IP of your machine? If you
> PING 'chemical-sourcing.com' do you get an answer?
>

I use the DNS of my registrar to point to the IP of my server. I haven't
try to ping 'chemical-sourcing.com' and as my server if off I can't do
the test now.
>
>>Can you me : I don't understant why I have these results.

>
>
> This result is usually due to the fact that Apache can't understand from
> your HTTP request which VHost you want, so it just 'serve' the first in
> the list (unless you have one marked as 'default'). The problem is how
> you send your request.
>
> Davide
>

OK, that what I suspected. How can I know how the request is send and
Apache VirtualHost configured (I am running under Win2000) ?

Jean-Marie
  Réponse avec citation
Vieux 01/02/2007, 10h25   #4
Davide Bianchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

On 2007-02-01, schneider <schneider.jeanm@free.fr> wrote:
> I use the DNS of my registrar to point to the IP of my server.


Hummm... then you should have a FQDN defined in the Virtual Host, not
just a 'name' like you reported.

> I haven't try to ping 'chemical-sourcing.com' and as my server if
> off I can't do the test now.


That's the first test to do, if you can't ping the server then there
is something wrong either with the name resolution or with the way
the networking is configured.

> OK, that what I suspected. How can I know how the request is send and
> Apache VirtualHost configured (I am running under Win2000) ?


The request is sent using your browser and the FQDN name you put in the
address bar. You haven't answered my original question: how do you
request the site.

Davide

--
Microsoft should switch to the vacuum cleaner business where people
actually want products that suck.
-- Bruno Bratti
  Réponse avec citation
Vieux 01/02/2007, 10h47   #5
shimmyshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

On 1 Feb, 10:25, Davide Bianchi <davideyeahs...@onlyforfun.net> wrote:
> On 2007-02-01, schneider <schneider.je...@free.fr> wrote:
>
> > I use the DNS of my registrar to point to the IP of my server.

>
> Hummm... then you should have a FQDN defined in the Virtual Host, not
> just a 'name' like you reported.
>
> > I haven't try to ping 'chemical-sourcing.com' and as my server if
> > off I can't do the test now.

>
> That's the first test to do, if you can't ping the server then there
> is something wrong either with the name resolution or with the way
> the networking is configured.
>
> > OK, that what I suspected. How can I know how the request is send and
> > Apache VirtualHost configured (I am running under Win2000) ?

>
> The request is sent using your browser and the FQDN name you put in the
> address bar. You haven't answered my original question: how do you
> request the site.
>
> Davide
>
> --
> Microsoft should switch to the vacuum cleaner business where people
> actually want products that suck.
> -- Bruno Bratti


I would add a hosts entry for all non-FQDN's (if you and your server
are on the same LAN) and
add another virtualhost to act as a default, so that if someone
accesses your server without using either phpmyadmin or chemical-
sourcing.com they dont see either site, you might not wish people to
default to a known site.
(make sure you haved banned everyone apart from you access to
phpmyadmin as well)

  Réponse avec citation
Vieux 01/02/2007, 17h34   #6
schneider
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

Davide Bianchi wrote:
> On 2007-02-01, schneider <schneider.jeanm@free.fr> wrote:
>
>>I use the DNS of my registrar to point to the IP of my server.

>
>
> Hummm... then you should have a FQDN defined in the Virtual Host, not
> just a 'name' like you reported.
>
>
>>I haven't try to ping 'chemical-sourcing.com' and as my server if
>>off I can't do the test now.

>
>
> That's the first test to do, if you can't ping the server then there
> is something wrong either with the name resolution or with the way
> the networking is configured.
>
>
>>OK, that what I suspected. How can I know how the request is send and
>>Apache VirtualHost configured (I am running under Win2000) ?

>
>
> The request is sent using your browser and the FQDN name you put in the
> address bar. You haven't answered my original question: how do you
> request the site.
>
> Davide
>

Thank you for your reply.
I just have ping my server with 'chemical-sourcing.com' or the IP of my
routeur... no answer. With the name I have the
following error "the host has not been found".
But when I open my browser (Firefox) and request the site by typing the
URL 'chemical-sourcing.com', the URL is rewrite to
http://www.chemical-sourcing.com and the page of phpMyAdmin is open.
That probably mean that the DNS of my registrar is correctly file, but
why the ping did not work ?

Thank again,
Jean-Marie
  Réponse avec citation
Vieux 01/02/2007, 17h40   #7
Davide Bianchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

On 2007-02-01, schneider <schneider.jeanm@free.fr> wrote:
> I just have ping my server with 'chemical-sourcing.com' or the IP of my
> routeur... no answer. With the name I have the
> following error "the host has not been found".


The there is obviously some problem in the DNS resolution of the name.

> But when I open my browser (Firefox) and request the site by typing the
> URL 'chemical-sourcing.com', the URL is rewrite to


The 'www' added to the name is something some browser do (and I hate
it), so the problem is that your Browser is asking for 'www....' while
your apache is configured to serve without the WWW. Add a ServerAlias
directive to your vhost with the www in front of the name and you should
be ok.

> That probably mean that the DNS of my registrar is correctly file, but
> why the ping did not work ?


'cause the ping looked up the name of the domain WITHOUT the www. The
computer does what you ask him to do, not what you *want* him to.

Davide

--
Windows: Where do you want to go today?
MacOS: Where do you want to be tomorrow?
Linux: Are you coming or what?
-- Linux Journal
  Réponse avec citation
Vieux 01/02/2007, 19h27   #8
schneider
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

Davide Bianchi a écrit :

> The 'www' added to the name is something some browser do (and I hate
> it), so the problem is that your Browser is asking for 'www....' while
> your apache is configured to serve without the WWW. Add a ServerAlias
> directive to your vhost with the www in front of the name and you should
> be ok.
>


I do that modification and its work fine. Thanks !!
Does that mean I have to have two virtualhosts for each site ?

Jean-Marie

> Davide
>

  Réponse avec citation
Vieux 01/02/2007, 21h40   #9
shimmyshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

On 1 Feb, 19:27, schneider <schneider...@free.fr> wrote:
> Davide Bianchi a écrit :
>
> > The 'www' added to the name is something some browser do (and I hate
> > it), so the problem is that your Browser is asking for 'www....'while
> > your apache is configured to serve without the WWW. Add a ServerAlias
> > directive to your vhost with the www in front of the name and you should
> > be ok.

>
> I do that modification and its work fine. Thanks !!
> Does that mean I have to have two virtualhosts for each site ?
>
> Jean-Marie
>
> > Davide


no, just use aliases:

<VirtualHost *:80>
DocumentRoot "c:/www/default"
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "c:/www/phpMyAdmin"
ServerName phpMyAdmin
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "c:/www/chemicalsourcing"
ServerName chemical-sourcing.com
ServerAlias www.chemical-sourcing.com cs.com anotherserver.com
</VirtualHost>

now if you goto
http://www.chemical-sourcing.com/
http://csc.com/ or
http://anotherserver.com/

it will match that last vhost stanza

however you DO need a hosts file entry (if you and the server are on
the LAN)
or a proper DNS entry for each host

if yo choose not to use FQDN for your hosts (like in the case of
phpmyadmin) then you should know that ookie management will be a
problem, so if you can stick to FQDMs that will be better.

c:\windows\system32\drivers\etc\hosts is the location for your hosts
file

127.0.0.1 cs.com anotherserver.com
is all you need to add to the hosts ( replace 127.0.0.1 with the IP
address to which apache is bound if different.)

  Réponse avec citation
Vieux 02/02/2007, 07h46   #10
Davide Bianchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

On 2007-02-01, schneider <schneider.jm@free.fr> wrote:
> I do that modification and its work fine. Thanks !!
> Does that mean I have to have two virtualhosts for each site ?


Not necessarily, you can have as many 'aliases' as you want for one single
VHost, using the ServerAlias directive to specify the aliases. You can also
use 'generic' aliases like *.somedomain that will 'match' every 'hostname'
in the .somedomain domain (www.somedomain, ftp.somedomain...)

See the documentation about ServerAlias.

Davide

--
The "ohfuck-moment": when you realize just after that rm -fr * that you
are hopelessy in the wrong directory.
  Réponse avec citation
Vieux 03/02/2007, 13h05   #11
schneider
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: VirtualHost issu

Thanks you for these very interesting explanations !!

Jean-Marie
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 08h33.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,24106 seconds with 19 queries