linux 安装 apache

1. 下载 apace http://httpd.apache.org/download.cgi

2. 推荐版本 2.2.x

理论上不同版本不会影响代码运行,但2.2.x作为最广泛使用的版本,保险起见用它。

以下是网络上搜索到的说明:

httpd-2.2.x(prefork)     httpd-2.4.x(event)

PHP官方推荐httpd使用prefork(php能更稳定地运行),而不是线程化的worker和event,httpd-2.4.x默认使用线程化的event作为mpm.

 Linux上很多PECL库都是非线程安全的,libphp5.so在线程化的httpd(event/worker)中运行可能会出现一些问题,为了保持兼容性和稳定性,PHP一般还是使用httpd-2.2.x(prefork)这个分支.

3. 操作步骤:

3.1 下载

$ cd Dowload
$ wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.27.tar.gz
3.2 解压

$ tar -zxvf httpd-2.2.27.tar.gz
3.3 配置 & 编译 & 安装

$ cd httpd-2.2.27<pre name="code" class="html">$ ./configure --prefix=/usr/local/httpd-2.2.27 --enable-proxy --enable-proxy-ajp --enable-ssl --enable-dav --enable-dav-fs --enable-dav-lock --enable-rewrite --enable-so
$ make
$ sudo make instal

 3.4 修改配置conf 
 

$ cd /usr/local/httpd-2.2.27/conf
$ sudo vim httpd.conf

修改:

3.4.1 apace 用户名和组

User daemon => User Username

Group daemon => Group Usergroup

3.4.2 修改权限

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

3.5 启动、停止、重启

$ sudo  /usr/local/httpd-2.2.27/bin/httpd -k start
$ sudo  /usr/local/httpd-2.2.27/bin/httpd -k stop
$ sudo  /usr/local/httpd-2.2.27/bin/httpd -k restart

 
 

3.6 错误解决

3.5.1 openssl

no OpenSSL headers foundchecking for SSL-C version... checking sslc.h usability... no

ubuntu 
$ sudo apt-get install libssl-dev
centos
$ sudo yum install openssl-dev





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值