LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-29-2009, 12:39 AM   #1
erics_acvw
LQ Newbie
 
Registered: Nov 2004
Location: Sparks, NV
Distribution: RH7.3, RH8.0, FC10, COS4.5
Posts: 25

Rep: Reputation: 16
Apache 2 httpd virtual hosts not working


Hi,

I am running CentOS 5.4 and Apache 2.2.3 straight out of the box. Problem is vhosts will not work. All I can get is a test page or the manual. The machine I am accessing from has the hosts file edited to point test.loc to 192.168.1.254 on my LAN. Owner:group are apache:apache, same as the server is running and permissions include read by owner. No errors in the logs. Any suggestions?

httpd.conf
<VirtualHost _default_:*>
DocumentRoot /var/www/apache/manual
# DocumentRoot /var/www/eswebs
</VirtualHost>

NameVirtualHost *:80

<VirtualHost *:80>
ServerName test.loc
ServerAlias test.com www.test.com test.loc www.test.loc
DocumentRoot /var/www/test
ServerAdmin me@some.com
ErrorLog logs/error_log
CustomLog logs/access_log combined
</VirtualHost>
============

Spill from -S command line option:
[root@server httpd]# httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:8443 69.109.23.9 (/etc/httpd/conf.d/nss.conf:73)
_default_:443 69.109.23.9 (/etc/httpd/conf.d/ssl.conf:81)
_default_:* 69.109.23.9 (/etc/httpd/conf/httpd.conf:995)
*:80 is a NameVirtualHost
default server test.com (/etc/httpd/conf/httpd.conf:4)
port 80 namevhost eswebs.com (/etc/httpd/conf/httpd.conf:4)
Syntax OK

Last edited by erics_acvw; 12-29-2009 at 02:49 AM.
 
Old 12-29-2009, 03:09 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You don't need the <VirtualHost _default_:*> for the vhost on port 80
Quote:
default server test.com (/etc/httpd/conf/httpd.conf:4)
port 80 namevhost eswebs.com (/etc/httpd/conf/httpd.conf:4)
Check httpd.conf, because from the above it looks like the default vhost is test.com (it should be test.loc) and the 1st vhost is eswebs.com (?).
 
Old 12-29-2009, 03:14 AM   #3
ashwin_cse
Member
 
Registered: Jul 2004
Distribution: arch, rhel, ubuntu, debian, gentoo
Posts: 134

Rep: Reputation: 22
In the httpd.conf comment out these lines :
<VirtualHost _default_:*>
DocumentRoot /var/www/apache/manual
# DocumentRoot /var/www/eswebs
</VirtualHost>

NameVirtualHost *:80

and make sure this is the only virtual host section you have:
<VirtualHost *:80>
ServerName test.loc
ServerAlias test.com www.test.com test.loc www.test.loc
DocumentRoot /var/www/test
ServerAdmin me@some.com
ErrorLog logs/error_log
CustomLog logs/access_log combined
</VirtualHost>

and it will work.
 
  


Reply



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
HTTPD and Virtual Hosts on RHEL Hambone23 Linux - Software 2 02-22-2009 10:04 PM
httpd could not be started - Virtual Hosts aztek Linux - Newbie 1 05-25-2006 11:06 PM
APACHE - Virtual Hosts luca2 Linux - Networking 3 12-27-2005 07:32 PM
httpd virtual hosts TKS Slackware 1 07-02-2004 10:31 PM
Virtual Hosts, defaults on port 81 with Apache not working S3ct0r Linux - Networking 2 06-19-2004 03:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:18 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
Open Source Consulting | Domain Registration