This is a discussion on Virtual domains with apache on SuSE within the Linux Web Servers forums, part of the Web Server and Related Forums category; I am getting a new server setup using SuSE 9.2 and mostly standard components from the suse distro, including ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am getting a new server setup using SuSE 9.2 and mostly standard
components from the suse distro, including apache2. I am trying to get virtual hosts set up, using the standard method, not automatic virtual hosts. Sites need to be identified by host, not IP. In other words, I need to be able to designate a site path anywhere on the system, not necessarily only subdirectories within one directory. I've read through the docs here: http://httpd.apache.org/docs-2.0/vhosts/name-based.html Originally, mod_vhost_alias was enabled; my understanding is that's for the automatic virtual hosts, and I've disabled it. UseCanonicalName is off. NameVirtualHost is set to my only IP address. The default server's path is: DocumentRoot /srv/www/htdocs virtual host 1 is: <VirtualHost *> DocumentRoot /home/vhost1/public_html ServerName "vhost1.subdom.csd-bes.net" <Directory "/home/vhost1/public_html"> allow from all Options +Indexes UseCanonicalName off </Directory> </VirtualHost> virtual host 2 is: <VirtualHost *> DocumentRoot /home/vhost2/public_html ServerName "vhost2.subdom.csd-bes.net" <Directory "/home/vhost2/public_html"> allow from all Options +Indexes UseCanonicalName off </Directory> </VirtualHost> In this configuration, all sites resolve to the vhost1 path. If I supply the specific IP address for vhost1 in the config above, all sites resolve to the vhost2 path. If I supply the IP address to both vhosts, all sites resolve to the default path. What's going on here? |
|
|||
|
On 11 Jul 2005 21:38:12 -0700, bronto <bronto@csd-bes.net> wrote:
> I am getting a new server setup using SuSE 9.2 and mostly standard > components from the suse distro, including apache2. > > I am trying to get virtual hosts set up, using the standard method, not > automatic virtual hosts. Sites need to be identified by host, not IP. > In other words, I need to be able to designate a site path anywhere on > the system, not necessarily only subdirectories within one directory. > I've read through the docs here: > http://httpd.apache.org/docs-2.0/vhosts/name-based.html > > Originally, mod_vhost_alias was enabled; my understanding is that's for > the automatic virtual hosts, and I've disabled it. UseCanonicalName is > off. NameVirtualHost is set to my only IP address. > > The default server's path is: > DocumentRoot /srv/www/htdocs > > virtual host 1 is: ><VirtualHost *> > DocumentRoot /home/vhost1/public_html > ServerName "vhost1.subdom.csd-bes.net" ><Directory "/home/vhost1/public_html"> > allow from all > Options +Indexes > UseCanonicalName off ></Directory> ></VirtualHost> > > virtual host 2 is: ><VirtualHost *> > DocumentRoot /home/vhost2/public_html > ServerName "vhost2.subdom.csd-bes.net" ><Directory "/home/vhost2/public_html"> > allow from all > Options +Indexes > UseCanonicalName off ></Directory> ></VirtualHost> > > In this configuration, all sites resolve to the vhost1 path. If I > supply the specific IP address for vhost1 in the config above, all > sites resolve to the vhost2 path. If I supply the IP address to both > vhosts, all sites resolve to the default path. > > What's going on here? Is the public IP used in NameVirtualHost actually on this computer? If the server is behind NAT or dynamic IP, you would likely need to use wildcard NameVirtualHost * I also had to use a bogus main ServerName, but that may be because my default vhost is a nameless worm trap, and when main ServerName matched one of my vhosts, things did not work right. Also check if anything in /etc/hosts might be throwing things off course if any of the names or IP are listed there. |