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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-10-2004, 07:08 AM
|
#1
|
Member
Registered: Jan 2004
Distribution: Fedora & Debian
Posts: 43
Rep:
|
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
|
|
|
09-10-2004, 07:14 AM
|
#2
|
Member
Registered: Aug 2004
Location: Switzerland
Distribution: debian
Posts: 149
Rep:
|
Have you set a default virtual server for the main server before all the others?
|
|
|
09-10-2004, 07:29 AM
|
#3
|
Member
Registered: Jan 2004
Distribution: Fedora & Debian
Posts: 43
Original Poster
Rep:
|
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?
|
|
|
09-11-2004, 05:59 AM
|
#4
|
Member
Registered: Dec 2002
Location: California
Distribution: Slackware & LFS
Posts: 799
Rep:
|
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
|
|
|
09-13-2004, 08:25 AM
|
#5
|
Member
Registered: Jan 2004
Distribution: Fedora & Debian
Posts: 43
Original Poster
Rep:
|
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?
|
|
|
11-10-2004, 09:38 AM
|
#6
|
LQ Newbie
Registered: Oct 2004
Posts: 12
Rep:
|
did you ever get this resolved?
I am having the same problem, runnign fc2. could you tell me what resolved it for you?
|
|
|
11-10-2004, 10:12 AM
|
#7
|
Member
Registered: Jun 2004
Distribution: OpenSuSE, CentOS, Linux From Scratch
Posts: 40
Rep:
|
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>
|
|
|
11-10-2004, 12:37 PM
|
#8
|
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:
|
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>
|
|
|
11-12-2004, 10:51 AM
|
#9
|
LQ Newbie
Registered: Nov 2004
Posts: 6
Rep:
|
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>
|
|
|
11-12-2004, 01:21 PM
|
#10
|
Member
Registered: Jun 2004
Distribution: OpenSuSE, CentOS, Linux From Scratch
Posts: 40
Rep:
|
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.....
|
|
|
11-15-2004, 08:04 PM
|
#11
|
LQ Newbie
Registered: Oct 2004
Posts: 12
Rep:
|
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?
|
|
|
All times are GMT -5. The time now is 04:40 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|