|
|
|
|
||||||
| alt.apache.configuration Apache web server configuration issues. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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) |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 > |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
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.) |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
Thanks you for these very interesting explanations !!
Jean-Marie |
|
![]() |
| Outils de la discussion | |
|
|