Linux - SoftwareThis 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.
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.
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
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?
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.
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?
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).
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>
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.