LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-15-2004, 01:21 PM   #1
frankd99
LQ Newbie
 
Registered: Dec 2003
Location: Ballston Lake, NY
Distribution: Fedora 5.0
Posts: 24

Rep: Reputation: 15
Apache 2.0 Virtual Host Problem


Hi all,

I have been having a problem getting Virtual hosts to work. After reading RH 9 docs and many posts I thought I had it right but it still is not working as I expect.

Here is some background:

Linux Disto - Red Hat 9.0 on LAN with IP of 192.168.2.103
DNS - Zoneedit with DynDNS to manage Dynamic IP address
Router - Linksys Cable/DSL with port 80 forwarded
Registered Domain Name - www.compunerdsmedia.com
Current Dynamic IP address - 24.195.132.227

Goal - To be able to serve www.compunerdsmedia.com and a sub-domain on the same Linux server.

First I added a new zone in zoneedit called webdev.compunerdsmedia.com and pionted it to 24.195.132.227.

Next I created a directory called webdev under /var/www/html and chmod 777

Then I modified the httpd.conf file with additional virtual host settings. The Virtual Host section follows:

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80


# Where do we put the lock and pif files?
LockFile "/var/lock/httpd.lock"
CoreDumpDirectory "/etc/httpd"

# Defaults for virtual hosts

# Logs
#
# Virtual hosts
#

# Virtual host Default Virtual Host
<VirtualHost *>

ServerSignature email

DirectoryIndex index.php index.html index.htm index.shtml

LogLevel warn
HostNameLookups off

</VirtualHost>

NameVirtualHost *:80

# Virtual host www.webdev.compunerdsmedia.com
<VirtualHost *:80>
DocumentRoot /var/www/html/webdev
ServerAdmin frank@compunerdsmedia.com
ServerName www.webdev.compunerdsmedia.com
ServerAlias webdev.compunerdsmedia.com *.webdev.compunerdsmedia.com
ServerSignature email
</VirtualHost>

# Virtual host www.compunerdsmedia.com
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerAdmin frank@compunerdsmedia.com
ServerName www.compunerdsmedia.com
ServerAlias compunerdsmedia.com *.compunerdsmedia.com
ServerSignature email
</VirtualHost>


I stopped and restarted httpd service, cranked up my IE 6.0 browser on my workstation and typed in www.compunerdsmedia.com. The home page displayed correctly.

Next I typed www.webdev.compunerdsmedia.com and the same home page displayed. What I expected to see was a form (index.html) display located in the /var/www/html/webdev directory.

Can anyone see any problem with my steps or with my httpd.conf settings?

Any help would be much appreciated.

Thanks,
Frank
 
Old 02-15-2004, 02:08 PM   #2
linuxxed
Member
 
Registered: Feb 2004
Posts: 273

Rep: Reputation: 30
Problems could be:

- You've got two entries for NameVirtualHost. Take the 80 out.
NameVirtualHost *

- Instead of using :80 everywhere in <VirtualHost>directive , try using just a * .
 
Old 02-15-2004, 04:18 PM   #3
frankd99
LQ Newbie
 
Registered: Dec 2003
Location: Ballston Lake, NY
Distribution: Fedora 5.0
Posts: 24

Original Poster
Rep: Reputation: 15
Apache 2.0 Virtual Host Problem

Hi,

I deleted the :80 from the directives and then I could no longer open the compunerdsmedia.com home page.

Could it be that Apache 2.0 wants the :80?

Thanks,
Frank
 
Old 02-16-2004, 01:23 PM   #4
frankd99
LQ Newbie
 
Registered: Dec 2003
Location: Ballston Lake, NY
Distribution: Fedora 5.0
Posts: 24

Original Poster
Rep: Reputation: 15
Apache 2.0 Virtual Host Problem

Quick update on my first post:

I opened my browser and typed www.compunerdsmedia.com/webdev/index.html and the correct page displayed.

Could it be that Apache Virtual Hosting only works when you add a new domain instead of a sub-domain? In other words add webdev.com instead of webdev.compunerdsmedia.com?

Anyone have any thoughts?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Virtual Host problem Seventh Linux - Software 2 03-19-2005 07:33 PM
Apache and Virtual Host Problem sekondborn Linux - Software 9 02-12-2005 03:26 PM
Apache virtual host problem Adrohak Linux - Software 3 07-18-2004 05:17 PM
Apache Virtual Host Problem clanx Linux - Software 3 01-07-2004 02:36 AM
Virtual Host Problem using Apache ataber Linux - Newbie 2 01-27-2003 01:32 PM


All times are GMT -5. The time now is 04:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration