apache, the most popular web server on the internet comes from the term

Upload: bonadefkijio

Post on 30-May-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    1/16

    ache Webserver Setup Guide by Joey.

    Created on November 29th, 1999.

    Last updated on September 19th, 2003.

    Apache, the most popular web server on the internet comes from the term "A PAtCHy server" since

    it was originally based off the NCSA httpd 1.3 code in early 1995. Apache can handle great server

    loads and run on sites that get over a million hits a day without any problems so as you see, it'sstable, it's highly configurable and best of all, it's free.

    The apache server comes in many different forms. There's RPM Packages, .deb Packages and of

    course, the source.

    This installation guide will be based on version 1.3.x of the Apache Source for a few reasons. For

    one, I still haven't upgraded to Apache 2.x due to ongoing issues with PHP and other modules. 1.3.x

    is still widely used and still works like a charm. As well, I prefer using the source for the installation

    rather than binary packages (.rpm's, .deb's etc) so I can specify paths etc. It also gives you the

    ability to apply patches when needed and makes life easier if you have to recompile Apache to add

    support for PHP or mod_ssl etc.

    The first thing you need to do is grab the Apache source from http://www.apache.org/dist/httpd/. At

    the time of updating this guide, the current version is 1.3.28. There are many files on their site but

    you only need the one called apache_1.3.28.tar.gz

    Once you've download the file, move it to /usr/local/src (I like to keep all my untarr'ed sources in

    /usr/local/src) and untar it by running the following command:

    tar -zxvf apache_1.3.28.tar.gz

    That will create a directory called apache_1.3.28 in /usr/local/src. Enter into that directory and run

    the following commands:

    ./configure --prefix=/usr/local/apache

    make

    make install

    This will install apache and all it's files into the /usr/local/apache directory. With the source

    installation there is only oneconfiguration file that needs to be edited, it is called httpd.conf and

    located in /usr/local/apache/conf. If you chose to install the DEB or RPM version, you will probably

    have to edit access.conf and srm.conf, so this guide will make no sense to you.

    Go into your apache configuration file directory, /usr/local/apache/conf and open up the httpd.conf

    file with your favorite text editor (nano, pico, vi, joe, etc). The httpd.conf file is well documented

    but I'll include some of the important options you will want to change/configure.

    * The following will tell Apache what user and group to run the server as. You definetly do not

    want to run the server as root. I suggest either leaving it as www-data or changing it to nobody. I

    like to create a user called apache and set the user/group to "apache".

    User www-data

    Group www-data

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    2/16

    * The ServerAdmin variable should be changed to the email address of whoever is running the

    web server. This email address will be shown on error pages etc.

    ServerAdmin [email protected]

    * ServerRoot is where all the Apache files and directories are. If you're following this guide tothe letter, set this as /usr/local/apache. On some systems it will be /home/httpd or /var/www if

    you've installed the RPM etc.

    ServerRoot /usr/local/apache

    * ErrorLog needs to be changed to wherever you set the log directory to. If you choose the

    default, then set it to /usr/local/apache/logs/error.log

    ErrorLog /usr/local/apache/logs/error.log

    * CustomLog is the same deal as ErrorLog. Set this to wherever you set the log directory to. This

    file will contain every connection and request to your Apache server. If you are running a very

    popular web server don't forget to rotate the logs once in awhile :)

    CustomLog /usr/local/apache/access.log combined

    * The PidFile variable should be changed to wherever you set the "runtimedir:" to. If you're

    unsure of what to set this as the leave it alone.

    PidFile /var/run/apache.pid

    * The LockFile option is pretty similar to the one above. If you're not sure what to set this to the

    leave it alone.

    LockFile /var/run/apache.lock

    * ServerName is an important one. You simply cannot make up a name here and hope Apacheworks because it won't. If you have a domain name such as example.com then enter it here. If you

    do not have a domain name but you have a Static IP (Your IP Address never changes) then enter in

    your IP address or hostname (ex: 215-112-252.sympatico.ca) If you have a Dynamic IP (Your IP

    changes every time you connect to the Internet) but you've set up a DynIP type of service, you can

    use that name here. (Such as yourname.dynip.com). If you don't have any of the above and your IP

    changes every time you connect, how do you expect people to find your server? :)

    ServerName www.example.com

    * MinSpareServers is the number of servers/httpd processes to have waiting in the backgroundfor clients to connect. The default settings are alright for most sites/configurations.

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    3/16

    MinSpareServers 5

    MaxSpareServers 15

    * StartServers is the number of servers that Apache should spawn when the server is started. 8 or

    10 is the norm.

    StartServers 8

    * ServerSignature will either enable or disable the server signature. The server signature will be

    displayed on error pages etc and will list your Apache server version and the server hostname. If

    you are the real paranoid type then you can disable it (change On to Off)

    ServerSignature On

    * DocumentRoot is where all your html pages will be stored. If you are following this guide to a'T' then you should set this to /usr/local/apache/htdocs. Being the huge rebel that I am, I like to

    change this to /usr/local/apache/html.

    DocumentRoot /usr/local/apache/htdocs

    * DirectoryIndex is what Apache will use as an index file for any given directory. If none of these

    are found, visitors will get a directory listing of the directory instead of an html page. (If Indexes

    are enabled for the directory).

    DirectoryIndex index.html index.shtml index.php index.cgi index.htm

    * AddHandler and AddType allow you to activate Server Side Includes (SSI), PHP and CGI

    scripts for your Apache Server. If you plan on using any of these you must add the following lines

    to your httpd.conf file.

    AddHandler cgi-script .cgi

    AddType text/html .shtml

    AddHandler server-parsed .shtml

    AddType application/x-httpd-php .phtml .php

    One of the great features with Apache is the ability to create virtual hosts. This gives you the ability

    to host multiple web sites on the same server with only one instance of Apache running. Below is an

    example of a virtual host entry:

    NameVirtualHost 216.187.106.215

    ServerName www.linuxhelp.ca

    ServerAlias linuxhelp.ca www.linuxhelp.net linuxhelp.netDocumentRoot /usr/local/apache/html/linuxhelp

    ErrorDocument 404 /404.php

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    4/16

    ErrorLog /usr/local/apache/logs/linuxhelp-error.log

    CustomLog /usr/local/apache/logs/access.log combined

    ScriptAlias /cgi-bin/ /usr/local/apache/html/linuxhelp/cgi-bin/

    Options FollowSymLinks Includes Indexes

    AllowOverride None

    AllowOverride None

    Options ExecCGI

    Order allow,deny

    Allow from all

    ServerName ldp.linuxhelp.caServerAlias ldp.linuxhelp.net

    DocumentRoot /usr/local/apache/html/ldp

    ErrorLog /usr/local/apache/logs/ldp-error.log

    CustomLog /usr/local/apache/logs/access.log combined

    This should be all the basics you need to get Apache up and running. Save and exit the httpd.conf

    (now is a good time to make a backup copy of it too) and then start up your Apache server by

    running the following as root:

    /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf

    After running the command you should be returned to the command prompt without any errors etc.

    If you want to make sure Apache is running you can type the following:

    ps aux | grep httpd

    And you should see a couple of lines that look something like this:

    www-data 10128 0.0 0.5 2224 1108 ? S 14:48 0:00 /usr/local/apache/bin/httpd

    If you see something similar to the above then great, Apache is up and running on your machine.Now for the ultimate test, open up your favorite web browser and try to access your website by

    going to either http://www.example.com or http://yourhostmask.com http://yourIP or

    http://yourname.dynip.com. You will probably see the something like the page located here.

    If for some reason apache failed to start up, it will probably tell you why. You should receive

    something like "something failed on line 204 of httpd.conf" etc. Simply open up the httpd.conf file

    again, go to that line and look for anything that doesn't seem right. You can also check your

    error.log file located at /usr/local/apache/logs/error.log to see if anything strange is going on. If you

    aren't sure what the error message means, try visiting http://www.google.com and searching for the

    error message. You'll be surprised at the results.

    As I said in the beginning of this guide, Apache isn't really that hard to set up; their httpd.conf file is

    well commented and their documentation at http://httpd.apache.org/docs/

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    5/16

    You might also want to visit our Guides Page and have a look at the various Guides that integrate

    other services (MySQL, PHP, .htaccess, Squid, SSL) with Apache.

    Having trouble? Got questions? Require further assistance? If so please feel free to visit our Help

    Forums and ask the experts!

    Copyright 1997 - 2010 Private World Domination Inc. All rights reserved.

    Linux is a registered trademark of Linus Torvalds. All other trademarks and copyrights are the

    property of their respective owners.

    | Contact Us | Link to Us | RSS Feed | Staff |

    parm,an

    tukang

    sayur

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    6/16

    parm,an

    tukang

    sayur

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    7/16

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    8/16

    robert

    adhi

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    9/16

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    10/16

    robert

    adhi

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    11/16

    robert

    adhi

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    12/16

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    13/16

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    14/16

    robert

    adhi

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    15/16

  • 8/9/2019 Apache, The Most Popular Web Server on the Internet Comes From the Term

    16/16