Apache安装过程
Step 1:安装包gcc或gcc-c++
# yum install gcc
#yum install gcc-c++
Step 2:安装包APR和APR-Util
apr-1.4.8.tar.gz apr-util-1.5.2.tar.gz
# tar -zxf apr-1.4.8.tar.gz
# cd apr-1.4.8
新建目录/usr/local/apr,用作安装目录:
# mkdir /usr/local/apr
# ./configure --prefix=/usr/local/apr
# make
# make install
安装apr-util
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make install
Step 3:安装包PRCE
# cd pcre-8.33
#mkdir /usr/local/pcre
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
# make
# make install
Step 4:安装Apache Http Server
# tar zxvf httpd-2.4.6.tar.gz
#cd httpd-2.4.6
#./configure --prefix=/opt/data/apache2 \
--enable-so \
--enable-mods-shared=most \
--with-mpm=worker \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--with-included-apr \
--with-pcre=/usr/local/pcre \
#make
#make install
Step 5:启动Apache服务
#/opt/data/apache2 /bin/apachectl start
用浏览器访问http://localhost时提示It works!
启动报错:
# /usr/local/apache/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using getlnx05.gfg1.esquel.com. Set the 'ServerName' directive globally to suppress this message
这个时候需要编辑httpd.conf配置文件,添加SeraverName的具体IP地址。
SeraverName 192.168.1.123:80
如果从其它电脑连接访问Apache时,输入url地址:http://ip 页面没有显示正常,而上面配置也OK,那么你必须关闭防火墙,有时候甚至需要重启电脑才能OK,重启Apache服务都无效。
# chkconfig iptables off
# chkconfig iptables off
# /usr/local/apache/bin/apachectl restart