13

Apache

Embed Size (px)

Citation preview

Page 1: Apache
Page 2: Apache

SYNAPSIS

Introduction

Download and extract the files

Configuring

Modules

Build and install

Customize

Test your server

Page 3: Apache

Introduction Apache is the most widely used HTTP-server in the world

today.

It surpasses all free and commercial competitors on the market, and provides a myriad of features; more than the nearest cmpetitor could give you on a UNIX variant.

It is also the most used web server for a Linux system.

A web server like Apache, in its simplest function, is software that displays and serves HTML pages hosted on a server to a client browser that understands the HTML code.

Mixed with third party modules and programs, it can become powerful software, which will provide strong and useful services to a client browser.

Page 4: Apache

Download Extract the Files

The best place to get Apache is from the Apache HTTP Server download site.

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.

Page 5: Apache

Configuring

Once you've got the files, you need to tell your machine where to find everything by configuring the source files.

This is done using the script configure included in the root directory of the distribution.

To configure the source tree using all the default options, simply type ./configure. To change the default options, configure accepts a variety of variables and command line options.

The most important option is the location --prefix where Apache is to be installed later, because Apache has to be configured for this location to work correctly

Page 6: Apache

Modules you can specify which features you want included in Apache by

enabling and disabling modules.

Apache comes with a Base set of modules included by default. Other modules are enabled using the --enable-module option,

module is the name of the module with the mod_ string removed and with any underscore converted to a dash.

You can also choose to compile modules as shared objects (DSOs) -- which can be loaded or unloaded at runtime -- by using the option --enable-module=shared.

Similarly, you can disable Base modules with the --disable-module option.

Be careful when using these options, since configure cannot warn you if the module you specify does not exist; it will simply ignore the option.

Page 7: Apache

...continued

You can also set specific environment variables and modules. Some of the modules 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

Page 8: Apache

It is sometimes necessary to provide the configure script with extra information about the location of your compiler, libraries, or header files.

This is done by passing either environment variables or command line options to configure.

For a short impression of what possibilities you have, here is a typical example which compiles Apache for the installation tree /sw/pkg/apache with a particular compiler and flags plus the two additional modules mod_rewrite and mod_speling for later loading through the DSO mechanism:

$ CC="pgcc" CFLAGS="-O2" \

./configure --prefix=/sw/pkg/apache \

--enable-rewrite=shared \

--enable-speling=shared

Page 9: Apache

Build and install

Now you can build the various parts which form the Apache package by simply running the command:

$ make

Now it's time to install the package under the configured installation PREFIX (see --prefix option above) by running:

$ make install

Page 10: Apache

customize

Next, you can customize your Apache HTTP server by editing the configuration files under PREFIX/conf/.

$ vi PREFIX/conf/httpd.conf

Note: you'll need to be root to edit this file.

Page 11: Apache

Test Your Server

Now you can start your Apache HTTP server by immediately running:

$ PREFIX/bin/apachectl start

And then you should be able to request your first document via URL http://localhost/.

The web page you see is located under the DocumentRoot which will usually be PREFIX/htdocs/. Then stop the server again by running:

$ PREFIX/bin/apachectl stop

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.

Page 12: Apache

Uninstall apache

• OPTION 1: Run this command if you installed apache with RPM or throug the automatic option during the Fedora/Red Hat OS installation.

Code : yum remove httpd

• OPTION 2: Run

Code: /etc/init.d/httpd stop to get the package name.

• It should come back with something like this:

Code: apachecfg-0.3.1-6

apache-1.2.5-1

• You can then use this command to remove Apache:

Code: rpm -e apache-1.2.5-1

Page 13: Apache

• OPTION 3.

If you compiled apache on your own. If you did a manual install then just delete /usr/local/apache (or wherever it is installed).

• OPTION 4.

if you are doing it manually then to remove Apache from your Linux server, enter this line at the Linux command prompt:

Code: rm -rf /usr/local/apache2

• OPTION 5:

To find files by name try "locate"; it will force you to run updatedb the first time.

• To find packages that are installed try rpm -qa *apache* *mysql*

{ note "rpm -qa" lists all installed packages }