LAMP环境配置之安装Apache

安装新版本的apache服务器apache

ps:根据博主的安装经历,依赖的包有apr,apr-util,pcre浏览器

环境:CentOS6.5服务器

Apache:httpd-2.4.10.tar.gzdom

 一、卸载apr、apr-util tcp

yum remove apr apr-util  测试

下载安装: 
http://apr.apache.org/download.cgi apr-1.4.6.tar.gz 
./configure --prefix=/usr/local/apr-httpd/ && make && make install  
ui

下载安装: 
http://apr.apache.org/download.cgi
apr-util-1.5.1.tar.gz 
./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/ && make && make install   
下载:http://sourceforge.net/projects/pcre #unzip -o pcre-8.32.zip #cd pcre-8.32 
#./configure --prefix=/usr/local/pcre #make 
#make install 
[root@localhost  httpd-2.4.3]# ./configure \ 
this

> --prefix=/usr/local/apache \ spa

> --enable-mods-shared=all \.net

 > --enable-deflate \

 > --enable-speling \ 

> --enable-cache \

 > --enable-file-cache \ 

> --enable-disk-cache \ 

> --enable-mem-cache \ 

> --enable-so \ 
> --enable-expires=shared \ 

> --enable-rewrite=shared \

 > --enable-static-support \ 

> --sysconfdir=/etc/httpd \ 
> --with-z=/usr/local/zlib/ \ 
> --with-apr=/usr/local/apr-httpd/ \ 
> --with-apr-util=/usr/local/apr-util-httpd/ \

 > --with-pcre=/usr/local/pcre/ \ 

> --disable-userdir 
#make && make install 
安装完成后,进入/usr/local/apache/目录下,检查是否有如下文件: 
bin  build  cgi-bin  error  htdocs  icons  include  logs  man  manual  modules 

启动Apache服务器,并查端口是否开启,启动Apache服务器的命令行以下: 
#/usr/local/apache/bin/apachectl start

 提示信息: 
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message 解决方案: 
vi /etc/httpd/httpd.conf 加上下面一行,重启apache 

ServerName localhost:80

查看端口命令行以下: 
#netstat -tnl|grep 80 
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                  
 LIST 

测试安装结果,打开浏览器,在地址栏中输入URL为:http://192.168.146.129/ 若是浏览器中出现It works!则代表Apache服务器可使用。 

每种服务器软件都有必要制成开机时自动启动,Apache服务器开机自动启动,只要在“/etc/rc.d/rc.local”文件,加上Apache服务器的启动命令便可。能够直接打开“/etc/rc.d/rc.local”文件,在最后一行写入Apache启动命令,也能够用echo命令追加进去,以下命令行示:

 [root@localhost  apache243]# echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local 

相关文章
相关标签/搜索