Apache1.x-在Linux上安装

作者:聂勇 欢迎转载,请保留作者信息并说明文章来源!

一、预备

  • 操作系统:SUSE LINUX Enterprise Server 9
  • apache_1.3.33.tar.gz

二、安装

1、解压和目录调整。

1
2
3
4
tar -zxvf apache_1.3.33.tar.gz
mv apache_1.3.33 apache_1.3.33_src
mkdir apache_1.3.33
cd apache_1.3.33_src

2、安装三步曲。

1
./configure --prefix=/nfs10/aofeng/apache_1.3.33

Configuring for Apache, Version 1.3.33
+ using installation path layout: Apache (config.layout)
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
+ configured for Linux platform
+ setting C compiler to gcc
+ setting C pre-processor to gcc -E
+ using “tr [a-z] [A-Z]” to uppercase
+ checking for system header files
+ adding selected modules
+ using system Expat
+ checking sizeof various data types
+ doing sanity check on compiler and options
Creating Makefile in src/support
Creating Makefile in src/regex
Creating Makefile in src/os/unix
Creating Makefile in src/ap
Creating Makefile in src/main
Creating Makefile in src/modules/standard

1
2
make
make install

待出现如下信息说明安装成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
+--------------------------------------------------------+
| You now have successfully built and installed the |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the |
| (initially created or preserved) configuration files |
| |
| /nfs10/nieyong/apache_1.3.33/conf/httpd.conf |
| |
| and then you should be able to immediately fire up |
| Apache the first time by running: |
| |
| /nfs10/nieyong/apache_1.3.33/bin/apachectl start |
| |
| Thanks for using Apache. The Apache Group |
| http://www.apache.org/ |
+--------------------------------------------------------+

三、验证

1、显示Apache的版本信息。

1
./httpd -v

Server version: Apache/1.3.33 (Unix)
Server built: Nov 17 2008 17:33:16

2、测试。

1
./apachectl start

./apachectl start: httpd started

1
./apachectl stop

./apachectl stop: httpd stopped

3、启动Apache。

1
./httpd -f /nfs10/aofeng/apache_1.3.33/conf/httpd.conf

提示:apache_1.3.33/logs/errror_log 日志文件中将显示类似这样的信息:

[Mon Nov 17 18:33:55 2008] [notice] Apache/1.3.33 (Unix) configured – resuming normal operations
[Mon Nov 17 18:33:55 2008] [notice] Accept mutex: sysvsem (Default: sysvsem)

4、打开浏览器器,输入URL,浏览器显示的界面如下:
图1

5、停止Apache。

1
kill -TERM 7250

说明:进程号7250通过查看apache_1.3.33/logs/httpd.pid 文件获得。
提示:apache_1.3.33/logs/errror_log 日志文件中将显示类似这样的信息:

[Mon Nov 17 18:33:44 2008] [notice] caught SIGTERM, shutting down

6、重启Apache。

1
kill -HUP 7250

提示:apache_1.3.33/logs/errror_log 日志文件中将显示类似这样的信息:

[Mon Nov 17 18:28:54 2008] [notice] SIGHUP received. Attempting to restart
[Mon Nov 17 18:28:54 2008] [notice] Apache/1.3.33 (Unix) configured – resuming normal operations
[Mon Nov 17 18:28:54 2008] [notice] Accept mutex: sysvsem (Default: sysvsem)

参考资料

1、http://httpd.apache.org/docs/1.3/install.html
2、http://httpd.apache.org/docs/1.3/invoking.html
3、http://httpd.apache.org/docs/1.3/stopping.html