Verify Your Virtual Host Configuration


When you have modified the Apache configuration file to add a virtual host, you can verify that it is configured properly before you start Apache with the following command.

 #/usr/sbin/httpd -t -DDUMP_VHOSTS 

Note 

Most versions of Apache also support the same functionality with the command:

 /usr/sbin/httpd -S 

The output of this command will depend on the virtual host method you selected.

For IP-based virtual hosts, both the VIP and the RIP addresses will appear on this report:

 #/usr/sbin/httpd -t -DDUMP_VHOSTS VirtualHost configuration: 10.1.1.2:80            www.yourdomain.com (/etc/httpd/conf/httpd.conf:1215) 209.100.100.3:80       www.yourdomain.com (/etc/httpd/conf/httpd.conf:1215) 

This example output indicates that line 1215 in the httpd.conf file contains the definition for both of these VirtualHost IP addresses.

For named-based virtual hosts, the output of this command looks like this:

 #/usr/sbin/httpd -t -DDUMP_VHOSTS VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:*                    www1.yourdomain.com (/etc/httpd/conf/httpd.conf:1215) *:*                    www2.yourdomain.com (/etc/httpd/conf/httpd.conf:1225) 

This example output indicates that two name-based virtual hosts have been defined in the httpd.conf file. When Apache runs as a daemon on this server it will be able to serve content for these two virtual hosts in response to HTTP requests from client computers.

image from book
IF DNS IS NOT CONFIGURED PROPERLY

If you are using IP-based virtual hosts and you used the UseCanonicalName DNS directive, this command will cause Apache to perform a reverse DNS query on the IP addresses you have specified in your VirtualHost containers. If you don't have DNS configured properly on your cluster nodes, Apache will complain:

 10.1.1.2:80 Bogus_host_without_reverse_dns (/etc/httpd/conf/httpd.conf:1200) 

This error indicates that line 1200 of the /etc/httpd/conf/httpd.conf file contains an IP address (the 10.1.1.2 RIP address, in this example) that Apache cannot find in DNS.

image from book



The Linux Enterprise Cluster. Build a Highly Available Cluster with Commodity Hardware and Free Software
Linux Enterprise Cluster: Build a Highly Available Cluster with Commodity Hardware and Free Software
ISBN: 1593270364
EAN: 2147483647
Year: 2003
Pages: 219
Authors: Karl Kopper

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net