LinuxQuestions.org
Review your favorite Linux distribution.
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 08-10-2006, 10:21 PM   #1
bioalchemist
Member
 
Registered: Oct 2005
Distribution: mandriva
Posts: 106

Rep: Reputation: 15
Apache2 - need help with virtual hosts


I have apache2 running on Debian Etch and it's working fine. What I'm trying to do is to point 2 different hosts to 2 different directories using the default file found in /etc/apache2/sites-available/ directory. I have 2 sites: blog.mysite.com and photos.mysite.com and I have it configured so that blog.mysite.com points to /var/www/serendipity/ while photos.mysite.com points to /usr/share/gallery2

So here's the funny part: When I open up a browser and type in photos.mysite.com, it comes back with the main.php page like it should (except the picture icons are missing), but none of the links work - they ALL give a 404 error.

Similarly, when I type in blog.mysite.com, the same thing happens. Page displays (without formatting - it's all messed up, but it displays so it's obvious that it's going to the correct directory), but any links you click on inside the page reveals a 404 error. Any ideas?

Oh, and I know these pages work fine because I was using an alias in my default file previously and everything was fine. Thanks!
 
Old 08-11-2006, 02:20 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,456

Rep: Reputation: 104Reputation: 104
are the paths to the links that dont show relative to the index.html/index.php or whatever? Are there "index" files in your sites? There are a lot of ways to build websites so i think you could post some more info...
if there are "index" files point your browser exactly to their address and see whether this changes something. I experienced that this might make a difference in the past.
cheers,j.

Last edited by j-ray; 08-11-2006 at 02:22 AM.
 
Old 08-11-2006, 02:42 AM   #3
rahulk
Member
 
Registered: Mar 2006
Posts: 110

Rep: Reputation: 16
can you paste me the httpd.conf content where you have defined these two virtualhosts??
 
Old 08-11-2006, 09:09 AM   #4
bioalchemist
Member
 
Registered: Oct 2005
Distribution: mandriva
Posts: 106

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by j-ray
are the paths to the links that dont show relative to the index.html/index.php or whatever? Are there "index" files in your sites? There are a lot of ways to build websites so i think you could post some more info...
if there are "index" files point your browser exactly to their address and see whether this changes something. I experienced that this might make a difference in the past.
cheers,j.
The file that is supposed to be shown is called "main.php" for the gallery one, and I'm not sure what it is for the blog. I'm using Serendipity, if that helps any. It almost seems like the main.php page points to a stylesheet or something that is not getting read. I can point my browser directly at that and I get the same result.

However if I add an alias to the default file from /etc/apache2/sites-available/

Alias /gallery /usr/share/gallery2

and then type this in the browser: photos.mysite.com/gallery everything works perfectly. Same with the blog.
 
Old 08-11-2006, 09:26 AM   #5
bioalchemist
Member
 
Registered: Oct 2005
Distribution: mandriva
Posts: 106

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by rahulk
can you paste me the httpd.conf content where you have defined these two virtualhosts??
Since I'm using Apache2, the httpd.conf file is used only for backward compatability, so it's an empty file. In Apache 2, the virtual hosts are defined in the default file that is located in /etc/apache2/. I made modifications to the original one and I've also tried reading in the Apache documentation and trying to create my own. Nothing seems to work, but here is the contents of the default file:

Code:
NameVirtualHost 192.168.3.10:80

<VirtualHost 192.168.3.10:80>
     DocumentRoot /usr/share/gallery2
     ServerName photos.mysite.com
     ServerAdmin me@gmail.com
     <Directory />
          Options FollowSymLinks
          AllowOverride None
     </Directory>
     ErrorLog /var/log/apache2/error.log
     LogLevel warn
     CustomLog /var/log/apache2/access.log combined
     ServerSignature On

     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

   Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

<VirtualHost 192.168.3.10:80>
     DocumentRoot /var/www/serendipity
     ServerName blog.mysite.com
     ServerAdmin me@gmail.com
     <Directory />
          Options FollowSymLinks
        AllowOverride None
     </Directory>
     ErrorLog /var/log/apache2/error.log
     LogLevel warn
     CustomLog /var/log/apache2/access.log combined
     ServerSignature On

     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

   Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

Alias /webmail /usr/share/squirrelmail
 
Old 08-11-2006, 02:24 PM   #6
bioalchemist
Member
 
Registered: Oct 2005
Distribution: mandriva
Posts: 106

Original Poster
Rep: Reputation: 15
Problem Solved! Had nothing to do with Apache - both Gallery and Serendipity needed configuration changes to get them to work correctly. Thanks for the replies!
 
  


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
Problems setting up virtual hosts with debian sarge and apache2 dthacker Debian 1 11-23-2005 06:25 PM
Subdomains on Apache2 with virtual hosts - how? <Ol>Origy Linux - Networking 2 08-18-2005 06:53 AM
Apache2 Virtual Dynamic Hosts and defaults techrolla Linux - Networking 1 11-01-2004 05:01 PM
Apache2, SSL, 2 Virtual Hosts franticbob Linux - Software 0 04-07-2004 10:48 PM
apache2 virtual hosts viniosity Linux - Software 4 02-07-2004 01:15 AM


All times are GMT -5. The time now is 07:27 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