当前位置:Gxlcms > PHP教程 > Centos66安装apache24

Centos66安装apache24

时间:2021-07-01 10:21:17 帮助过:21人阅读

安装以下包需要gcc,请安装gcc yum install gcc

1.安装apr-1.5.1.tar.gz

[plain] view plaincopy

  1. tar -zxvf apr-1.5.1.tar.gz
  2. cd apr-1.5.1
  3. ./configure --prefix=/usr/local/apr
  4. make
  5. make install

2.安装apr-util-1.5.4.tar.gz

[html] view plaincopy

  1. tar -zxvf apr-util-1.5.4.tar.gz
  2. cd apr-util-1.5.4
  3. ./configure --with-apr=/usr/local/apr
  4. make
  5. make install

3.安装pcre-8.36.tar.gz

[plain] view plaincopy

  1. tar -zxvf pcre-8.36.tar.gz
  2. cd pcre-8.36
  3. ./configure --prefix=/usr/local/pcre
  4. make
  5. make install

4.安装httpd-2.4.10.tar.gz

[plain] view plaincopy

  1. tar -zxvf httpd-2.4.10.tar.gz
  2. cd httpd-2.4.10
  3. ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-pcre=/usr/local/pcre/
  4. make
  5. make install

5.修改/usr/local/apache/conf/httpd.conf

找到#ServerName www.example.com:80修改为ServerName localhost:80

6.将http加入service

[plain] view plaincopy

  1. cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd

7.修改/etc/rc.d/init.d/httpd

在#!/bin/bash下加入

[plain] view plaincopy

  1. # chkconfig: 2345 50 90
  2. # description:Activates/Deactivates Apache Web Server)

8.启动apache

[html] view plaincopy

  1. service httpd start

9.验证apache是否启动成功

[plain] view plaincopy

  1. lsof -i:80

出现如下输出则证明apache启动

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 4158 root 4u IPv6 50349 0t0 TCP *:http (LISTEN)
httpd 4159 daemon 4u IPv6 50349 0t0 TCP *:http (LISTEN)
httpd 4160 daemon 4u IPv6 50349 0t0 TCP *:http (LISTEN)
httpd 4161 daemon 4u IPv6 50349 0t0 TCP *:http (LISTEN)

以上就介绍了Centos66安装apache24,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行