apache 2 安装

来源:互联网 发布:阿里云实名认证 编辑:程序博客网 时间:2024/06/05 20:57
 

Overview for the impatient

Download$ lynx http://httpd.apache.org/download.cgi
Extract$ gzip -d httpd-2_0_NN.tar.gz
$ tar xvf httpd-2_0_NN.tar
Configure$ ./configure --prefix=PREFIX
Compile$ make
Install$ make install
Customize$ vi PREFIX/conf/httpd.conf
Test$ PREFIX/bin/apachectl start

 

Download

Apache can be downloaded from the Apache HTTP Server download site which lists several mirrors.

 

 

Extract

Extracting the source from the Apache HTTPD tarball is a simple matter of uncompressing, and then untarring:

$ gzip -d httpd-2_0_NN.tar.gz
$ tar xvf httpd-2_0_NN.tar

 

 

Configuring the source tree


./configure --prefix=/sw/pkg/apache /
--enable-rewrite=shared /
--enable-speling=shared

When configure is run it will take several minutes to test for the availability of features on your system and build Makefiles which will later be used to compile the server.

Details on all the different configure options are available on the configure manual page.

 

 

Build

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

$ make

Please be patient here, since a base configuration takes approximately 3 minutes to compile under a Pentium III/Linux 2.2 system, but this will vary widely depending on your hardware and the number of modules which you have enabled.

 

 

Install

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

$ make install

If you are upgrading, the installation will not overwrite your configuration files or documents.

top

Customize

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

$ vi PREFIX/conf/httpd.conf

Have a look at the Apache manual under docs/manual/ or consult http://httpd.apache.org/docs/2.0/ for the most recent version of this manual and a complete reference of available configuration directives.

top

Test

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