码迷,mamicode.com
首页 > Web开发 > 详细

CentOS 7 Apache 2.4.23 安装 配置 启动

时间:2016-12-14 21:24:35      阅读:316      评论:0      收藏:0      [点我收藏+]

标签:start   check   显示   div   efi   handle   direct   --   time   

下载Apache安装包  httpd-2.4.23.tar.gz

下载地址:http://apache.fayea.com/httpd/

Apache 安装要求

必须安装APR、APR-Util、PCRE,gcc-c++等包

编译命令:(除了指定Apache的安装目录外,还要安装apr、apr-util、pcre,并指定参数)

[root@bogon software]# tar -zxvf httpd-2.4.23.tar.gz
[root@bogon software]# cd httpd-2.4.23
[root@bogon httpd-2.4.23]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre 
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
[root@bogon httpd-2.4.23]#

 

在编译Apache时出现了问题

http://apr.apache.org/download.cgi  下载apr-1.5.2.tar.gz、apr-util-1.5.4.tar.gz
http://www.pcre.org/ 官网
https://sourceforge.net/projects/pcre/files/pcre/  选择pcre下载,不用pcre2
下载最新版本pcre-8.39.tar.gz

解决apr问题

[root@bogon software]# tar -zxvf apr-1.5.2.tar.gz
[root@bogon software]# cd apr-1.5.2/
[root@bogon apr-1.5.2]# ./configure --prefix=/usr/local/apr
[root@bogon apr-1.5.2]# make
[root@bogon apr-1.5.2]# make install

 

解决APR-util问题 

[root@bogon software]# tar -zxvf apr-util-1.5.4.tar.gz
[root@bogon software]# cd apr-util-1.5.4/
[root@bogon apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
[root@bogon apr-util-1.5.4]# make
[root@bogon apr-util-1.5.4]# make install

 

解决pcre-config问题

[root@bogon software]# tar -zxvf pcre-8.39.tar.gz
[root@bogon software]# cd pcre-8.39
[root@bogon pcre-8.39]# ./configure --prefix=/usr/local/pcre
[root@bogon pcre-8.39]# make
[root@bogon pcre-8.39]# make install

 

再次编译httpd-2.4.23:

[root@bogon software]# cd httpd-2.4.23
[root@bogon httpd-2.4.23]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre 
[root@bogon httpd-2.4.23]# make
[root@bogon httpd-2.4.23]# make install

 

启动Apache:/usr/local/apache2/bin/apachectl start
停止Apache:/usr/local/apache2/bin/apachectl stop
重启Apache:/usr/local/apache2/bin/apachectl restart

网站放在/usr/local/apache2/htdocs目录下

在IE中通过http://localhost:80,如果看到页面中显示“It works!”字样,则代表Apache验证通过。如果网站的index后缀是PHP格式的,则要修改httpd.conf配置文件(/usr/local/apache2/conf),在DirectoryIndex增加 index.php。

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

 

CentOS 7 Apache 2.4.23 安装 配置 启动

标签:start   check   显示   div   efi   handle   direct   --   time   

原文地址:http://www.cnblogs.com/liuzhenlife/p/6180568.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!