What is the proper way to server multiple domain names with httpd?
I have a server in my basement that is currently serving a bunch of different websites for 3 TLDs. The only way I have ever known how to make this work is to add a bunch of these to the bottom of my httpd config file:
Quote:
also if it helps whenever i start the httpd service, i get these errors [root@nethost root]# /sbin/service httpd restart Stopping httpd: [ OK ] Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [Fri Dec 19 13:53:22 2008] [warn] NameVirtualHost 192.168.1.80:80 has no VirtualHosts [ OK ] (one for each site) |
You don't need the "NameVirtualHost 192.168.1.80:80" before each VirtualHost. That may cause the error. Do you want to remove the text colouring so we can read that btw?
Depending on you distro, you may be able to separate your virtual definitions into /etc/httpd/conf.d or similar. Not quite sure I'd bother though. |
I have one single 'NameVirtualHost' entry followed by numerous VirtualHost sections, and it's been working fine for quite some time :)
I agree with Billymayday -- nix those NameVirtualHost entries (save for the first). |
Different distributions of Linux have different ways of implementing Virtual Hosts. Debian and derivatives use a separate /etc/apache2/sites-available directory in which separate individual virtual host files are maintained. A virtual host is enabled using the command:
Code:
a2ensite virtualsitefilename This command creates a link in the /etc/apache2/sites-enabled directory. When Apache2 is reloaded or started the configuration files are read from the /etc/apache2/sites-enabled directory to initialize the virtual hosts. I prefer this implementation to the all in one httpd.conf file. |
All times are GMT -5. The time now is 03:03 PM. |