|AITech Solutions Home Site Map Support Contact Us Website & Servers|
|Apache Tutorial Topics: Apache Web Server introduction, Apache Redirection guide with examples|
The Apache HTTP Server is a Popular, Free, Open Source, Multi-platform Server that according to netcraft.com as of March 2014 is used by over 38.6% of web sites. It is highly customizable with its own built in directives and by add on modules. Our goal here is to provide help with the more popular questions and to provide a deeper but easy to understand guide for the more complex and confusing issues and resolutions. Use the links at the top and on the right pane to navigate through the topics. On this page we provide current release information and an overview on how to configure the Apache HTTP server. In the second article of this series we look into URL redirection and how to handle this on an Apache server.
The Apache HTTP server is configured by text files and the main required file is usually called httpd.conf normally located in the conf directory just under Apache's root folder. The httpd.conf file contains "directives" that define the main or overall server configuration. You can include comments in the file by preceding the line with a "#" symbol. Note that comment lines can't be on the very next line after a directive. If a particular directive is not working, first insure there is a blank line between the directive and any comments. The best way to order the directives is to place the "must have" items first with a sub order of general to specific. Keep in mind that the configuration is processed sequentially. If you add a directive or option and it is not working, make sure that any dependencies are configured or required modules are loaded first. Also, Configure error logging early so that any errors that may occur during start up may be logged to aid in fault isolation. Many areas of httpd.conf are broken up into sections or containers delimited or enclosed in start < > and stop </> tags. For example the <Directory> container is used where you want to set particular attributes for the servers file space. The <VirtualHost> and </VirtualHost> directives enclose sections that configure, you guessed it, virtual hosts. To make it even more clear the option or function of a section and make managing the configuration easier you can use external text files to hold your directives. These files follow the same rules as the main httpd.conf file and are called into the configuration by using the include directive. Note that the order the directives in the included files are processed just as if you inserted them in the httpd.conf at that include statement. As above, if you add an include, position it in httpd.conf so that no dependencies exist that still need to be configured. The syntax of include is very simple. Include [path]filename Example Include /conf/extra/vhosts.conf You can specify the whole absolute path or specify it as relative to the servers document root. Finally, Another configuration file that is used on a per-directory basis is (normally) named .htaccess. This file is placed in the particular directory whose attributes you want to modify so implicitly functions similar to directives added to the directory container in the server configuration. This is typically used to modify the server configuration for a particular virtual host and is thus usually placed in that virtual hosts document root. It is important to note that .htaccess follows the same syntax of httpd.conf but, unlike httpd.conf where changes take effect only on a server restart, .htaccess directives are examined each time the particular directory that .htaccess is contained within is accessed. Use of an .htaccess file is controlled by the AllowOverride configuration directive. This is normally used in a directory container in httpd.conf or in a vhosts.conf for virtual hosting servers. AllowOverride All is the default setting which allows any valid htaccess directive to be used. To prohibit use of the htaccess use the AllowOverride None statement in the particular directory container you wish to affect. As this is just a short overview I'll stop here for now. Hope this helps your understanding of the function and overall structure of these configuration files. Remember, to be safe, always create a backup before editing these files.