Virtual Hosting question

This is a discussion on Virtual Hosting question within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello again, I am running Apache on an XP computer as a server. I have two domains pointing at my ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-09-2005
James Warren
 
Posts: n/a
Default Virtual Hosting question

Hello again,
I am running Apache on an XP computer as a server. I have two domains
pointing at my IP address. It doesn't matter which address I type in from a
browser, only "company1" comes up. The server is behind a hardware
firewall, and is assigned 192.168.0.2. I suspect this is easy, but I am
just learning Apache configuration.


Here is what I have in the hppd.conf:

NameVirtualHost *:80
<VirtualHost 192.168.0.2>
Servername www.company1.com
DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company1"
</VirtualHost>

<VirtualHost 192.168.0.2>
Servername www.company2.com
DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company2"
</VirtualHost>

Thanks in advance,
Jim


  #2 (permalink)  
Old 03-09-2005
Uncle Pirate
 
Posts: n/a
Default Re: Virtual Hosting question

James Warren wrote:

> Hello again,
> I am running Apache on an XP computer as a server. I have two domains
> pointing at my IP address. It doesn't matter which address I type in from a
> browser, only "company1" comes up. The server is behind a hardware
> firewall, and is assigned 192.168.0.2. I suspect this is easy, but I am
> just learning Apache configuration.


I had a similar problem when switching from Apache 1.3.x to 2.0.x. I
don't know if this is the correct way to do it but it works for me. I
added a dummy domain in as the default using the same document root as
my first real domain. I had more than two domains going and the first
worked (default), the second gave me the default, the rest worked. So
now, the (dummy) default is never used, the second gives me the default,
and the rest work.

--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
Coordinator, Tularosa Basin Chapter, ABATE of NM; AMA#758681; COBB
'94 1500 Vulcan (now wrecked) :( http://motorcyclefun.org/Dcp_2068c.jpg
A zest for living must include a willingness to die. - R.A. Heinlein
  #3 (permalink)  
Old 03-09-2005
No 33 Secretary
 
Posts: n/a
Default Re: Virtual Hosting question

"James Warren" <warren.james.d@att.net> wrote in
news:GNzXd.117361$Th1.63295@bgtnsc04-news.ops.worldnet.att.net:

> Hello again,
> I am running Apache on an XP computer as a server. I have two domains
> pointing at my IP address. It doesn't matter which address I type in
> from a browser, only "company1" comes up. The server is behind a
> hardware firewall, and is assigned 192.168.0.2. I suspect this is
> easy, but I am just learning Apache configuration.
>
>
> Here is what I have in the hppd.conf:
>
> NameVirtualHost *:80
> <VirtualHost 192.168.0.2>
> Servername www.company1.com
> DocumentRoot "c:/program files/Apache
> Group/Apache2/htdocs/usr/Company1"
> </VirtualHost>
>
> <VirtualHost 192.168.0.2>
> Servername www.company2.com
> DocumentRoot "c:/program files/Apache
> Group/Apache2/htdocs/usr/Company2"
> </VirtualHost>
>

As noted, drop the IP address. Begin each <VirtualHost> with

<VirtualHost *:80>

Then, turn off the service, open a command line window, and start Apache
manually. This way, you can see any error messages generated.

--
Terry Austin
www.hyperbooks.com
Campaign Cartographer now available
  #4 (permalink)  
Old 03-09-2005
BWK
 
Posts: n/a
Default Re: Virtual Hosting question

On Wed, 09 Mar 2005 09:59:02 GMT, "James Warren" <warren.james.d@att.net> wrote:

>Hello again,
>I am running Apache on an XP computer as a server. I have two domains
>pointing at my IP address. It doesn't matter which address I type in from a
>browser, only "company1" comes up. The server is behind a hardware
>firewall, and is assigned 192.168.0.2. I suspect this is easy, but I am
>just learning Apache configuration.
>
>
>Here is what I have in the hppd.conf:
>
>NameVirtualHost *:80
><VirtualHost 192.168.0.2>
> Servername www.company1.com
> DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company1"
></VirtualHost>
>
><VirtualHost 192.168.0.2>
> Servername www.company2.com
> DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company2"
></VirtualHost>
>
>Thanks in advance,
>Jim
>


Here are VirtualHost entries which should work:

<VirtualHost *:80 *:443>
DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company1"
ServerName company1.com
ServerAlias *.company1.com
CustomLog logs/company1_access_log combined
</VirtualHost>

<VirtualHost *:80 *:443>
DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company2"
ServerName company2.com
ServerAlias *.company2.com
CustomLog logs/company2_access_log combined
</VirtualHost>

--
Brendan
  #5 (permalink)  
Old 03-09-2005
David
 
Posts: n/a
Default Re: Virtual Hosting question

BWK wrote:
> On Wed, 09 Mar 2005 09:59:02 GMT, "James Warren" <warren.james.d@att.net> wrote:
>
>
>>Hello again,
>>I am running Apache on an XP computer as a server. I have two domains
>>pointing at my IP address. It doesn't matter which address I type in from a
>>browser, only "company1" comes up. The server is behind a hardware
>>firewall, and is assigned 192.168.0.2. I suspect this is easy, but I am
>>just learning Apache configuration.
>>
>>
>>Here is what I have in the hppd.conf:
>>
>>NameVirtualHost *:80
>><VirtualHost 192.168.0.2>
>> Servername www.company1.com
>> DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company1"
>></VirtualHost>
>>
>><VirtualHost 192.168.0.2>
>> Servername www.company2.com
>> DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company2"
>></VirtualHost>
>>
>>Thanks in advance,
>>Jim
>>

>
>
> Here are VirtualHost entries which should work:
>
> <VirtualHost *:80 *:443>
> DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company1"
> ServerName company1.com
> ServerAlias *.company1.com
> CustomLog logs/company1_access_log combined
> </VirtualHost>
>
> <VirtualHost *:80 *:443>
> DocumentRoot "c:/program files/Apache Group/Apache2/htdocs/usr/Company2"
> ServerName company2.com
> ServerAlias *.company2.com
> CustomLog logs/company2_access_log combined
> </VirtualHost>
>
> --
> Brendan



The only thing I will suggest is that the
ServerAlias should be www.company1.com not *.company1 or company2.com

the reason being is that if say I wanted sub virtual domains the above
would answer to anything, which might not be the desired effect.

ie: employees.company1.com
repair.company1.com

I wuld be sure in this case it would send the user to an undesired
directory.

Just a thought
  #6 (permalink)  
Old 03-09-2005
James Warren
 
Posts: n/a
Default Re: Virtual Hosting question

Thank you all very much, I truely appreciate the response. I'll make the
recommended changes and get back with you on the result.

Regards,
Jim
"David" <dwmoar@findmoore.net> wrote in message
news:y_ednbuIvJWYobLfRVn-jg@megapath.net...
> BWK wrote:
>> On Wed, 09 Mar 2005 09:59:02 GMT, "James Warren" <warren.james.d@att.net>
>> wrote:
>>
>>
>>>Hello again,
>>>I am running Apache on an XP computer as a server. I have two domains
>>>pointing at my IP address. It doesn't matter which address I type in
>>>from a browser, only "company1" comes up. The server is behind a
>>>hardware firewall, and is assigned 192.168.0.2. I suspect this is easy,
>>>but I am just learning Apache configuration.
>>>
>>>
>>>Here is what I have in the hppd.conf:
>>>
>>>NameVirtualHost *:80
>>><VirtualHost 192.168.0.2>
>>> Servername www.company1.com
>>> DocumentRoot "c:/program files/Apache
>>> Group/Apache2/htdocs/usr/Company1"
>>></VirtualHost>
>>>
>>><VirtualHost 192.168.0.2>
>>> Servername www.company2.com
>>> DocumentRoot "c:/program files/Apache
>>> Group/Apache2/htdocs/usr/Company2"
>>></VirtualHost>
>>>
>>>Thanks in advance,
>>>Jim

>>
>>
>> Here are VirtualHost entries which should work:
>>
>> <VirtualHost *:80 *:443>
>> DocumentRoot "c:/program files/Apache
>> Group/Apache2/htdocs/usr/Company1"
>> ServerName company1.com
>> ServerAlias *.company1.com
>> CustomLog logs/company1_access_log combined
>> </VirtualHost>
>>
>> <VirtualHost *:80 *:443>
>> DocumentRoot "c:/program files/Apache
>> Group/Apache2/htdocs/usr/Company2"
>> ServerName company2.com
>> ServerAlias *.company2.com
>> CustomLog logs/company2_access_log combined
>> </VirtualHost>
>>
>> --
>> Brendan

>
>
> The only thing I will suggest is that the
> ServerAlias should be www.company1.com not *.company1 or company2.com
>
> the reason being is that if say I wanted sub virtual domains the above
> would answer to anything, which might not be the desired effect.
>
> ie: employees.company1.com
> repair.company1.com
>
> I wuld be sure in this case it would send the user to an undesired
> directory.
>
> Just a thought



  #7 (permalink)  
Old 03-09-2005
James Warren
 
Posts: n/a
Default Re: Virtual Hosting question

You guys are awsome! Problem solved, and we are off and running - er -
VirtualHosting.

God Bless,
Jim
"BWK" <cyclorider1@yahoo.com> wrote in message
news:ludu219plds42c8c8g2i1gts6lash0m7kg@4ax.com...
> On Wed, 09 Mar 2005 09:59:02 GMT, "James Warren" <warren.james.d@att.net>
> wrote:
>
>>Hello again,
>>I am running Apache on an XP computer as a server. I have two domains
>>pointing at my IP address. It doesn't matter which address I type in from
>>a
>>browser, only "company1" comes up. The server is behind a hardware
>>firewall, and is assigned 192.168.0.2. I suspect this is easy, but I am
>>just learning Apache configuration.
>>
>>
>>Here is what I have in the hppd.conf:
>>
>>NameVirtualHost *:80
>><VirtualHost 192.168.0.2>
>> Servername www.company1.com
>> DocumentRoot "c:/program files/Apache
>> Group/Apache2/htdocs/usr/Company1"
>></VirtualHost>
>>
>><VirtualHost 192.168.0.2>
>> Servername www.company2.com
>> DocumentRoot "c:/program files/Apache
>> Group/Apache2/htdocs/usr/Company2"
>></VirtualHost>
>>
>>Thanks in advance,
>>Jim
>>

>
> Here are VirtualHost entries which should work:
>
> <VirtualHost *:80 *:443>
> DocumentRoot "c:/program files/Apache
> Group/Apache2/htdocs/usr/Company1"
> ServerName company1.com
> ServerAlias *.company1.com
> CustomLog logs/company1_access_log combined
> </VirtualHost>
>
> <VirtualHost *:80 *:443>
> DocumentRoot "c:/program files/Apache
> Group/Apache2/htdocs/usr/Company2"
> ServerName company2.com
> ServerAlias *.company2.com
> CustomLog logs/company2_access_log combined
> </VirtualHost>
>
> --
> Brendan



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:06 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0