LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Ubuntu Linux Virtual hosting (https://www.linuxquestions.org/questions/linux-server-73/ubuntu-linux-virtual-hosting-586933/)

MJWhiteDerm 09-24-2007 06:06 AM

Ubuntu Linux Virtual hosting
 
The implementation of apache2 in ubuntu does not match implementation in other distributions, or as described at the apache2.org documention sites.

I'm trying to figure out how to add multiple virtual hosts to the apache2 configuration. Here's what I understand...

1.) There is no more httpd.conf. It exists, but is empty. Everything is done in apache2.conf.

2.) Virtual sites are added in /etc/apache2/sites-available/ where a configuration file (NameVirtualHost directive) is placed for each host, including the default host (named default). Then, a symbolic link is added to /etc/apache2/sites-enabled/, pointing to each file in /sites-available.

3) To fully enable a virtual host, a symbolic link has to point to the file. That is created by "sudo a2ensite [I]nameofnewsite[I]. This is per the ubuntu documentation for apache2, which differs from the apache2 documentation, even though it also points to apache's documentation.

That is, I have followed the instructions in the Ubuntu HTTPD - Apache2 Web Server documentation and I still can't get the virtual hosting to work.

Apache2 is working fine. I have unbuntu 6.06 running on this machine. It has several web pages. My fixed IP address is 64.91.78.105 and all of my multiple DNS entries point to that address. (I actually own a whole range of addresses, but I kept it simple for the moment because of a possible router issue.)

www.cthia.com points to 64.91.78.105 and is now the default web page. It comes up fine. That is, I call up my friend and say, look at the web site _______ (there are several), and apache shows the web site. The DEFAULT web site is now cthia, and it shows up fine out on the external world.

www.laxlinux.com also points to the same external IP and my router successfully sends a port 80 request to the same internal machine. But ... cthia comes up. www.laxlinux.com/laxlinux loads the correct page. Ditto for /mikhailbadenov or /primumnonnocere which are two other web pages.

I copied the file /etc/apache2/sites-available/default file and made modifications. The default file now points to cthia. I modified the copies and have one for laxlinux and one for mikhailbadenov and one for primumnonnocere.

I enabled laxlinux and mikhailbadenov, as per the instructions in the ubuntu documentation with sudo a2ensite laxlinux (etc) for each site. Each site's file in /sites-available is appropriately copied over to sites-enabled and I restarted apache2. There is a ServerName statement in each file and a DirectoryRoot statement in each file, pointing to the respective directories. The RedirectMatch statement in each file is modified to reflect the appropriate virtual host.

When I reboot apache2, I get a statement:
Name or service not known: Cannot resolve host name laxlinux (or www.laxlinux) -- Ignoring!

If I try to put these directives in apache2.conf, it chokes and gives me a FAIL message.

I'm missing something, somewhere.

Anyone have any clue what I might be forgetting?

also: michael.white@gemair.com

Thanks, in advance.

Michael

MJWhiteDerm 09-25-2007 12:59 PM

More data, Possible Cause:

The Ubuntu Linux Bible section on virtual hosting tells you uncomment "line 16" in the default configuration file in /etc/apache2/sites-available and then also tells you to copy the file and use slightly different versions of that file for each of the virtual hosts.

Line 16 is the RedirectMatch directive. It might be the issue.


All times are GMT -5. The time now is 11:27 AM.