Basic troubleshooting in Apache server

by Prabakaran 2012-09-05 23:01:47

Use the httpd -t or apache2ctl -t commands to check the syntax of all loaded configuration files.

Use the httpd -S or apache2ctl -S commands to ensure that your virtual host is enabled and configured with the options you intend.

If you are running mod_python, mod_rails (e.g. Phusion Passenger, or mod_rack), mod_ruby or other dynamic language and you've made changes to your application which aren't reflected on the public interface, you might need to restart Apache.

To restart the server, issue "/etc/init.d/httpd restart", "/etc/init.d/apache2 restart" or "/etc/rc.d/httpd restart". These interfaces cache code internally, and do not reread scripts on new requests. Restarting the server may produce several seconds of downtime.

If you've changed your configuration options but they haven't taken effect, you may need to reload the configuration for the webserver.

Issue "/etc/init.d/httpd reload", "/etc/init.d/apache2 reload" or "/etc/rc.d/httpd reload" to reload the web server's configuration without producing downtime. Note, restarting the server also reloads the configuration.

If you've modified a configuration option and reloaded the server configuration, but the new option has not taken effect, your configuration option may have been overridden by a conflicting directive. Common possibilities include:
Directives set later in the configuration file conflict with earlier directives. Remember that includes are "read" in place at the point of the include before the original file is read.
.htaccess files are read before resources are served, while <Directory> settings are read whenever the server starts or is reloaded. As a result .htaccess files can override directory configuration. Disable .htaccess files to troubleshoot.
<Location> directives are read last in the process and can override settings determined specified in <Directory>, and <Files> sections.

Configuration files are read serially. Sometimes an option set in the beginning of the httpd.conf or apache2.conf file can be overridden by a setting in a file in conf.d/ or by a virtual host file.

This extends to the Include directive. When includes specify an entire directory files from that directory are included sequentially based on name.

Debian-based systems have a /etc/apache2/ports.conf file which is the "NameVirtualHost" and "Listen" directives are set. These values determine what IP address or addresses Apache binds to, and on which port(s) the web server listens for HTTP requests. This can sometimes conflict with settings in other files.

Ensure that the syntax of a "NameVirtualHost" directive matches the IP address and port numbers of the defined <VirtualHost>. If "NameVirtualHosts *:80", then the virtual host configuration should begin with "<VirtualHost *:80>". If "NameVirtualHosts 123.234.123.234:80", then the virtual host configuration should begin with "<VirtualHost 123.234.123.234:80>". If "NameVirtualHosts *", then the virtual host configuration should begin with "<VirtualHost *>". You can have multiple NameVirtualHost values, which is the case if you're running sites on multiple IPs and ports, but <VirtualHost> configurations need to correspond to configured NameVirtualHost directives.
641
like
0
dislike
0
mail
flag

You must LOGIN to add comments