一、部署apache
1、下载apache安装包及依赖包
http://httpd.apache.org/download.cgi#apache24(apache2)
http://apr.apache.org/download.cgi(下载APR和APR-util)
http://pcre.org/(下载PCRE,不要pcre2)
2、安装apr
./configure --prefix=/usr/local/apr (安装目录)
make
make install
3、安装apr-util
yum install expat-devel(apr-util依赖开发库)
./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr
make
make install
4、安装pcre
./configure --prefix=/usr/local/pcre
如果需要c++编译器:yum install -y gcc gcc-c++
make
make install
5、安装apache2
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
make
make install
6、apache2启动
conf/http.conf中配置端口号和ServerName
Listen 80 修改成ip+端口号
新增ServerName
sh bin/apachectl start 启动
访问ip+端口号,显示
It works!
表示正常工作