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

80.LAMP中的apache安装

时间:2018-02-28 10:34:03      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:LAMP   apachi   

apache介绍

Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩充,将Perl/Python等解释器编译到服务器中。同时Apache音译为阿帕奇,是北美印第安人的一个部落,叫阿帕奇族,在美国的西南部。也是一个基金会的名称、一种武装直升机等等

操作系统版本

[root@localhost src]# uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost src]#

获取链接

apache官方网址:www.apache.org

2.2源码包: http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz

2.4源码包: http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz

apr: http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz

apr-util: https://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz

PS:apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以方便移植(Linux移植到Windows)

apache安装条件:必须先安装gcc包、pcre包、apr与apr-util;

一:安装下列7个包
yum -y install gcc
yum -y install expat-devel
yum install -y pcre-devel
yum install -y libxml2-devel
wget  http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz
wget apr: http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz
wget apr-util: https://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz

二:进行安装apr包,

[root@localhost apr-1.6.3]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.6.3]# echo $?
[root@localhost apr-1.6.3]# 0
[root@localhost apr-1.6.3]# make $$ install make
[root@localhost apr-1.6.3]# ls /usr/local/apr/
bin build-1 include lib
[root@localhost apr-1.6.3]#

三:安装apr-util包

[root@localhost src]# cd apr-util-1.6.1
[root@localhost apr-util-1.6.1]#
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# echo $?
[root@localhost apr-util-1.6.1]# 0
[root@localhost apr-util-1.6.1]#make
[root@localhost apr-util-1.6.1]#echo $?
[root@localhost apr-util-1.6.1]#make install
[root@localhost apr-util-1.6.1]# ls /usr/local/apr-util/
bin include lib
[root@localhost apr-util-1.6.1]#

四:安装apache(http)

[root@localhost src]#
[root@localhost src]# cd httpd-2.4.29/
[root@localhost httpd-2.4.29]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
[root@localhost httpd-2.4.29]# echo $?
[root@localhost httpd-2.4.29]# make
[root@localhost httpd-2.4.29]# echo $?
[root@localhost httpd-2.4.29]# make install

五:开启apache

/usr/local/apache2.4/bin/apachectl start
PS:如果在启动过程中遇到错误的话 参考 下面的链接
http://blog.csdn.net/zhaomininternational/article/details/42293511

检测端口

[root@localhost conf]# ps aux |grep httpd
root 34738 0.0 0.4 71400 2136 ? Ss 02:30 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 34739 0.0 0.8 360364 4248 ? Sl 02:30 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 34740 0.0 0.8 360364 4248 ? Sl 02:30 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 34741 0.0 0.8 360364 4248 ? Sl 02:30 0:00 /usr/local/apache2.4/bin/httpd -k start
root 34824 0.0 0.1 112676 984 pts/0 S+ 02:30 0:00 grep --color=auto http
[root@localhost conf]#

查看所加载的模块

[root@localhost conf]# /usr/local/apache2.4/bin/httpd -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
[root@localhost conf]#

80.LAMP中的apache安装

标签:LAMP   apachi   

原文地址:http://blog.51cto.com/sdwaqw/2073748

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