LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-18-2004, 02:48 PM   #1
Adrohak
Member
 
Registered: Jun 2004
Location: Florida
Distribution: Gentoo
Posts: 148

Rep: Reputation: 15
Apache virtual host problem


I am trying to set up Apache so that I can have multiple names (from Dyndns.org) point to different areas of my website. Example: I want xae.ath.cx to automatically be directed to /var/www/htdocs/xae instead of /var/www/htdocs.

I set up Dyndns to point xae.ath.cx to my box.
I added the following line to /etc/hosts:
127.0.0.1 xae.ath.cx slackbox
I added the following to /etc/apache/httpd.conf:
<VirtualHost xae.ath.cx>
ServerAdmin root@xae.ath.cx
DocumentRoot /var/www/htdocs/xae
ServerName xae.ath.cx
ErrorLog /var/log/apache/sub/xae/error_log
CustomLog /var/log/apache/sub/xae/access_log common
</VirtualHost>
/var/log/apache/sub/xae/error_log exists; /var/log/apache/sub/xae/access_log exists.
(Edit: forgot to say I did this..) /etc/rc.d/rc.httpd restart

Using this setup, everytime any HTTP request is sent to my box, it is redirected to the contents of /var/www/htdocs/xae. After that, I figured, "Well maybe I should just add another VirtualHost entry for my main site also."

Dyndns points adrohak.ath.cx to my box.
/etc/hosts:127.0.0.1 adrohak.ath.cx slackbox
<VirtualHost adrohak.ath.cx>
ServerAdmin root@adrohak.ath.cx
DocumentRoot /var/www/htdocs
ServerName adrohak.ath.cx
ErrorLog /var/log/apache/error_log
CustomLog /var/log/apache/access_log common
</VirtualHost>
/var/log/apache/error_log exists; /var/log/apache/access_log exists.
(Edit: forgot to say I did this..) /etc/rc.d/rc.httpd restart

adrohak.ath.cx grabs me the contents of /var/www/htdocs... But so does xae.ath.cx.

What do I need to do to fix this?

Last edited by Adrohak; 07-18-2004 at 02:51 PM.
 
Old 07-18-2004, 03:37 PM   #2
Pete M
Member
 
Registered: Aug 2003
Location: UK
Distribution: Redhat 9 FC 3 SUSE 9.2 SUSE 9.3 Gentoo 2005.0 Debian Sid
Posts: 657

Rep: Reputation: 31
Adrohak
Quote:
Now when a request arrives, the server will first check if it is using an IP address that matches the NameVirtualHost. If it is, then it will look at each <VirtualHost> section with a matching IP address and try to find one where the ServerName or ServerAlias matches the requested hostname. If it finds one, then it uses the configuration for that server. If no matching virtual host is found, then the first listed virtual host that matches the IP address will be used.
This quote is from Apache Docs Here

So presumably Apache is looking to match www.xae.ath.cx and can't find it

Try

<VirtualHost *:80>
ServerAdmin root@adrohak.ath.cx
DocumentRoot /var/www/htdocs
ServerName www.adrohak.ath.cx
ErrorLog /var/log/apache/error_log
CustomLog /var/log/apache/access_log common
</VirtualHost>
#
<VirtualHost *:80>
ServerAdmin root@xae.ath.cx
DocumentRoot /var/www/htdocs/xae
ServerName www.xae.ath.cx
ErrorLog /var/log/apache/sub/xae/error_log
CustomLog /var/log/apache/sub/xae/access_log common
</VirtualHost>

I assume Apache has permission to access /var/www/htdocs/xae ?
By default Apache can only access /var/www/htdocs
If this is the case try this

<VirtualHost *:80>
ServerAdmin root@adrohak.ath.cx
DocumentRoot /var/www/htdocs
ServerName www.adrohak.ath.cx
ErrorLog /var/log/apache/error_log
CustomLog /var/log/apache/access_log common
</VirtualHost>
#
<VirtualHost *:80>
ServerAdmin root@xae.ath.cx
DocumentRoot /var/www/htdocs/xae
ServerName www.xae.ath.cx
ErrorLog /var/log/apache/sub/xae/error_log
CustomLog /var/log/apache/sub/xae/access_log common
<Directory "/var/www/htdocs/xae">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


Pete
 
Old 07-18-2004, 03:57 PM   #3
Adrohak
Member
 
Registered: Jun 2004
Location: Florida
Distribution: Gentoo
Posts: 148

Original Poster
Rep: Reputation: 15
Thanks for trying to help, Pete, but unfortunately, neither the first nor the second solution worked.
 
Old 07-18-2004, 05:17 PM   #4
Pete M
Member
 
Registered: Aug 2003
Location: UK
Distribution: Redhat 9 FC 3 SUSE 9.2 SUSE 9.3 Gentoo 2005.0 Debian Sid
Posts: 657

Rep: Reputation: 31
Adrohak

Not sure if this is relevant but at the moment your DNS records don't appear to list

xae.ath.cx
adrohak.ath.cx

There does,nt appear to be any cnames or aliases to your domain

Only ath.cx will resolve

Try yourself here DNS Report

Pete
 
  


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 2.0 Virtual Host Problem frankd99 Linux - Software 3 02-16-2004 01:23 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 03:22 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration