Published on

  • Be the first to comment

  • Be the first to like this


  2. 2. INTRODUCTION : Apache is one of the most popular Web servers on the Web right now, and part of its charm is that it's free. It also has a lot of features that make it very extensible and useful for many different types of Web sites. It is a server that is used for personal Web pages up to enterprise level sites. This article will discuss how to install Apache on a Linux system. Before we start you should be at least comfortable working in Linux - changing directories, using tar and gunzip, and compiling with make (I'll discuss where to get binaries if you don't want to mess with compiling your own). You should also have access to the root account on the server machine.
  3. 3. Download Apache I recommend downloading the latest stable release. At the time of this writing, that was Apache 2.0. The best place to get Apache is from the Apache HTTP Server download site. Download the sources appropriate to your system. Binary releases are available as well. Extract the Files Once you've downloaded the files you need to uncompress them and untarring: gunzip -d httpd-2_0_NN.tar.gz tar xvf httpd-2_0_NN.tar This creates a new directory under the current directory with the source files.
  4. 4. Configuring Once you've got the files, you need to tell your machine where to find everything by configuring the source files. The easiest way is to accept all the defaults and just type: ./configure Of course, most people don't want to accept just the default choices. The most important option is the prefix= option. This specifies the directory where the Apache files will be installed. You can also set specific environment variables and modules. Some of the modules I like to have installed are: * mod_alias - to map different parts of the URL tree * mod_include - to parse Server Side Includes * mod_mime - to associate file extensions with its MIME-type * mod_rewrite - to rewrite URLs on the fly * mod_speling (sic) - to help your readers who might misspell URLs * mod_ssl - to allow for strong cryptography using SSL * mod_userdir - to allow system users to have their own Web page directories
  5. 5. Build As with any source installation, you'll then need to build the installation: make make install Customize Assuming that there were no problems, you are ready to customize your Apache configuration. This really just amounts to editing the httpd.conf file. This file is located in the PREFIX/conf directory. I generally edit it with vi: vi PREFIX/conf/httpd.conf Note: you'll need to be root to edit this file. Follow the instructions in this file to edit your configuration the way you want it. More help is available on the Apache Web site. Test Your Server Open a Web browser on the same machine and type http://localhost/ in the address box. You should see a page similar to the one in the partial screen shot above. Specifically, it will say in big letters "Seeing this instead of the website you expected?" This is good news, as it means your server installed correctly.
  6. 6. 1.AcceptFilter directive <ul><li>Syntax: AcceptFilter on|off </li></ul><ul><li>Default: AcceptFilter on </li></ul><ul><li>Context: server config </li></ul><ul><li>Status: core </li></ul><ul><li>Compatibility: AcceptFilter is available in Apache 1.3.22 and later </li></ul><ul><li>AcceptFilter controls a BSD specific filter optimization </li></ul>
  7. 7. 2.AcceptMutex directive <ul><li>AcceptMutex directive </li></ul><ul><li>Syntax: AcceptMutex uslock|pthread|sysvsem|fcntl|flock|os2sem|tpfcore|none|default </li></ul><ul><li>Default: AcceptMutex default </li></ul><ul><li>Context: server config </li></ul><ul><li>Status: core </li></ul><ul><li>Compatibility: AcceptMutex is available in Apache 1.3.21 and later. </li></ul><ul><li>AcceptMutex controls which accept() mutex method Apache will us </li></ul>
  8. 8. 3.AccessConfig directive <ul><li>Syntax: AccessConfig file-path|directory-path|wildcard-path </li></ul><ul><li>Default: AccessConfig conf/access.conf </li></ul><ul><li>Context: server config, virtual host </li></ul><ul><li>Status: core </li></ul><ul><li>Compatibility: The ability to specify a directory, rather than a file name, is only available in Apache 1.3.13 and later. This directive will be eliminated in version 2.0. </li></ul>This feature can be disabled using: AccessConfig /dev/null Or, on Win32 servers,
  9. 9. 4.AddDefaultCharset directive Syntax: AddDefaultCharset On|Off|charset Context: all Status: core Default: AddDefaultCharset Off Compatibility: AddDefaultCharset is only available in Apache 1.3.12 and later AddDefaultCharset On enables Apache's internal default charset of iso-8859-1 as required by the directive. You can also specify an alternate charset to be used. For example: AddDefaultCharset utf-8
  10. 10. 5.AddModule directive Syntax: AddModule module [module] ... Context: server config Status: core Compatibility: AddModule is only available in Apache 1.2 and later For example: AddModule mod_include.c
  11. 11. 6.AllowOverride directive Syntax: AllowOverride All|None|directive-type [directive-type] ... Default: AllowOverride All Context: directory Status: core AllowOverride is only valid in <Directory> sections, not in <Location> or <Files> sections, as implied by the Context section above
  12. 12. 7.AuthName directive AuthName directive Syntax: AuthName auth-domain Context: directory, .htaccess Override: AuthConfig Status: cor sets the name of the authorization realm for a directory It must be accompanied by AuthType and Require directives, and directives such as AuthUserFile and AuthGroupFile to work. For example: AuthName &quot;Top Secret&quot; The string provided for the AuthName is what will appear in the password dialog provided by most browsers.
  13. 13. 8.AuthDigestRealmSeed directive Syntax: AuthDigestRealmSeed secret-real-string Context: directory, .htaccess Override: AuthConfig Status: core sets a per realm secret nonce prefix which is used to ensure that a captured username, password and realm string during a Digest exchange cannot be replayed at other places.
  14. 14. 9.AuthType directive Syntax: AuthType Basic|Digest Context: directory, .htaccess Override: AuthConfig Status: core This directive selects the type of user authentication for a directory. Only Basic and Digest are currently implemented. It must be accompanied by AuthName and Require directives, and directives such as AuthUserFile and AuthGroupFile to work.
  15. 15. 10.CGICommandArgs directive <ul><li>Syntax: CGICommandArgs On|Off </li></ul><ul><li>Default: CGICommandArgs On </li></ul><ul><li>Context: directory, .htaccess </li></ul><ul><li>Override: Options </li></ul><ul><li>Status: core </li></ul><ul><li>Compatibility: Available in Apache 1.3.24 and later. </li></ul>
  16. 16. 11.ClearModuleList directive <ul><li>Syntax: ClearModuleList </li></ul><ul><li>Context: server config </li></ul><ul><li>Status: core </li></ul><ul><li>Compatibility: ClearModuleList is only available in Apache 1.2 and later. </li></ul><ul><li>This directive clears the list. It is assumed that the list will then be re-populated using the AddModule directive. </li></ul>
  17. 17. 12.ContentDigest directive <ul><li>Syntax: ContentDigest on|off </li></ul><ul><li>Default: ContentDigest off </li></ul><ul><li>Context: server config, virtual host, directory, .htaccess </li></ul><ul><li>Override: Options </li></ul><ul><li>Status: experimental </li></ul><ul><li>Compatibility: ContentDigest is only available in Apache 1.1 and later </li></ul><ul><li>This directive enables the generation of Content-MD5 headers as defined in RFC1864 respectively RFC2068 </li></ul>
  18. 18. 13.CoreDumpDirectory directive <ul><li>Syntax: CoreDumpDirectory directory-path </li></ul><ul><li>Default: the same location as ServerRoot </li></ul><ul><li>Context: server config </li></ul><ul><li>Status: core </li></ul><ul><li>This controls the directory to which Apache attempts to switch before dumping core. </li></ul>
  19. 19. 14.DefaultType directive <ul><li>Syntax: DefaultType MIME-type </li></ul><ul><li>Default: DefaultType text/plain </li></ul><ul><li>Context: server config, virtual host, directory, .htaccess </li></ul><ul><li>Override: FileInfo </li></ul><ul><li>Status: core </li></ul><ul><li>There will be times when the server is asked to provide a document whose type cannot be determined by its MIME types mappings. </li></ul><ul><li>The server must inform the client of the content-type of the document, so in the event of an unknown type it uses the DefaultType. For example: </li></ul><ul><li>DefaultType image/gif </li></ul>
  20. 20. 15.DirectoryMatch <ul><li><DirectoryMatch> </li></ul><ul><li>Syntax: <DirectoryMatch regex> ... </DirectoryMatch> </li></ul><ul><li>Context: server config, virtual host </li></ul><ul><li>Status: Core. </li></ul><ul><li>Compatibility: Available in Apache 1.3 and late </li></ul><ul><li><DirectoryMatch> and </DirectoryMatch> are used to enclose a group of directives which will apply only to the named directory and sub-directories of that directory, the same as <Directory>. However, it takes as an argument a regular expression. </li></ul><ul><li>For example: </li></ul><ul><li><DirectoryMatch &quot;^/www/.*/[0-9]{3}&quot;> </li></ul>