LinuxQuestions.org
Visit Jeremy's Blog.
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 09-10-2004, 08:08 AM   #1
Baltasar
Member
 
Registered: Jan 2004
Distribution: Fedora & Debian
Posts: 43

Rep: Reputation: 15
Question Apache Problem


Hi,

I run Apache 2.x on a FC 2 box and host some virtual hosts.
I have some problems with the Main Server and the virtual host configuration.
For explanation i will call the server name www.domain1.com and 2 virtual host server names www.domain2.com and www.domain3.com.
When i enter www.domain1.com in my Internet browser, the apache server will use the Document Root from www.domain2.com and
if i remove www.domain2.com it will took www.domain3.com Document Root
The virtual hosts are working all fine.
Where lies the problem

thank you in advance!
Baltasar
 
Old 09-10-2004, 08:14 AM   #2
Charalambos
Member
 
Registered: Aug 2004
Location: Switzerland
Distribution: debian
Posts: 149

Rep: Reputation: 15
Have you set a default virtual server for the main server before all the others?
 
Old 09-10-2004, 08:29 AM   #3
Baltasar
Member
 
Registered: Jan 2004
Distribution: Fedora & Debian
Posts: 43

Original Poster
Rep: Reputation: 15
No i did not.
Shouldn't i get an error message 40x instead of the server is choosing a random DirectroyRoot if there is no default virtual host Directive?
 
Old 09-11-2004, 06:59 AM   #4
Cerbere
Member
 
Registered: Dec 2002
Location: California
Distribution: Slackware & LFS
Posts: 799

Rep: Reputation: 33
Quote:
Originally posted by Baltasar
No i did not.
Shouldn't i get an error message 40x instead of the server is choosing a random DirectroyRoot if there is no default virtual host Directive?
No, it won't give an error, nor will it choose a random DirectoryRoot. The first VirtualHost listed is the default.

The following is from the Apache 2.0 documentation:
Quote:
Main host goes away

If you are adding virtual hosts to an existing web server, you must also create a <VirtualHost> block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.
Enjoy!
--- Cerbere
 
Old 09-13-2004, 09:25 AM   #5
Baltasar
Member
 
Registered: Jan 2004
Distribution: Fedora & Debian
Posts: 43

Original Poster
Rep: Reputation: 15
Thank you for your response!

My first virtual host in the httpd.conf is now the main server www.domain1.com and after that i have an "Include vhosts/*.conf", so all virtual hosts has got it's own config file, but my problem is still there. The web server is still loading the first *.conf file which he finds in the vhosts directory.

Is it a good idea to rename the mainservers ServerName to localhost and just work with virtual hosts?
 
Old 11-10-2004, 10:38 AM   #6
knightdog
LQ Newbie
 
Registered: Oct 2004
Posts: 12

Rep: Reputation: 0
did you ever get this resolved?

I am having the same problem, runnign fc2. could you tell me what resolved it for you?
 
Old 11-10-2004, 11:12 AM   #7
didi86
Member
 
Registered: Jun 2004
Distribution: OpenSuSE, CentOS, Linux From Scratch
Posts: 40

Rep: Reputation: 15
I'm having a similar problem as well:

I'm trying to set up 3 Virtual hosts in my local intranet: "www.linux", "chris.linux" and "wolfgang.linux".
As soon as I try to access any of them, I end up in the first one (www.linux).

Here is my vhosts.conf:
<VirtualHost *:80>
ServerAdmin didi@didi-site.de
ServerName www.linux
ServerAlias www.linux *.www.linux
DocumentRoot /srv/www/htdocs/
</VirtualHost>
<VirtualHost *:80>
ServerAdmin didi@didi-site.de
ServerName chris.linux
ServerAlias chris.linux *.chris.linux
DocumentRoot /srv/www/htdocs/chris
</VirtualHost>
<VirtualHost *:80>
ServerAdmin wolfgang.rueprich@kinderarzt-saalkreis.de
ServerName wolfgang.linux
ServerAlias wolfgang.linux *.wolfgang.linux
DocumentRoot /srv/www/htdocs/wolfgang
</VirtualHost>
 
Old 11-10-2004, 01:37 PM   #8
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: 32
didi86

Does Apache have permission to access
/srv/www/htdocs/chris
/srv/www/htdocs/wolfgang

By default permission is denied on all folders, so try this

Also folders /chris and /wolfgang should be world readable

<VirtualHost *:80>
ServerAdmin didi@didi-site.de
ServerName www.linux
ServerAlias www.linux *.www.linux
DocumentRoot /srv/www/htdocs/
</VirtualHost>
<VirtualHost *:80>
ServerAdmin didi@didi-site.de
ServerName chris.linux
ServerAlias chris.linux *.chris.linux
DocumentRoot /srv/www/htdocs/chris
<Directory "/srv/www/htdocs/chris">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin wolfgang.rueprich@kinderarzt-saalkreis.de
ServerName wolfgang.linux
ServerAlias wolfgang.linux *.wolfgang.linux
DocumentRoot /srv/www/htdocs/wolfgang
<Directory "/srv/www/htdocs/wolfgang">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
 
Old 11-12-2004, 11:51 AM   #9
rufusss
LQ Newbie
 
Registered: Nov 2004
Posts: 6

Rep: Reputation: 0
Apache Cofiguration

In my apache setting i only use the:
<VirtualHost *:80> for the default virtual host and for the remaining virtual host i the one ip address for all the remaining virtualHost.
<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /www/html
</VirtualHost>
<VirtualHost 192.168.1.2:80>
ServerName www.yourhost.com
DocumentRoot /www/html
</virtualHost>
 
Old 11-12-2004, 02:21 PM   #10
didi86
Member
 
Registered: Jun 2004
Distribution: OpenSuSE, CentOS, Linux From Scratch
Posts: 40

Rep: Reputation: 15
Quote:
Does Apache have permission to access
/srv/www/htdocs/chris
/srv/www/htdocs/wolfgang
As far as I know it does: These 2 folders are subfolders in www.linux and are accessable with www.linux/chris and www.linux/wolfgang

I also tried your version of vhosts.conf and it doesn't work for me.....
 
Old 11-15-2004, 09:04 PM   #11
knightdog
LQ Newbie
 
Registered: Oct 2004
Posts: 12

Rep: Reputation: 0
didi86,

what are your url's? I used 3 from no-ip.com. if i used port 80 only one of them worked, and it was the first one no matter what order. if i put them all on different ports ( i.e. 81 82 83, then they all worked correctly). and if i put it back to all on port 80 then back to only the first working. so the big question is are you using a redirector?
 
  


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
Strange apache trailing / problem - Slack-current, apache 1.3.33 vamp Linux - Networking 1 01-30-2005 08:28 PM
problem with apache 1.3.27 czarherr Linux - Software 2 01-10-2004 12:38 PM
RH9: PHP session problem (or Apache problem) fengcn Red Hat 0 12-01-2003 07:32 PM
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 08:45 PM
apache benchmarks (apache v13 / apache v20) ; large differences between benchmarking markus1982 Linux - Software 0 02-08-2003 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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