一、下载需要的包
yum install expat-devel
apache24
http://httpd.apache.org/download.cgi#apache24
APR && APR util
Unix Source: apr-1.6.2.tar.gz [PGP] [MD5]
Unix Source: apr-util-1.6.0.tar.gz [PGP] [MD5]
http://apr.apache.org/download.cgi
http://archive.apache.org/dist/apr/
二、编译
apr ./configure make && make install
apr util ./configure –with-apr=/usr/local/apr make && make install
安装正则库
yum install pcre pcre-devel
httpd
./configure –prefix=/usr/local/myapache –enable-MODULE=shared make && make install
这种报错解决办法:yum install expat-devel
xml/apr_xml.c:434: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:438: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:442: error: ‘apr_xml_parser’ has no member named ‘xp_err’
xml/apr_xml.c:442: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c: In function ‘apr_xml_parser_geterror’:
xml/apr_xml.c:500: error: ‘apr_xml_parser’ has no member named ‘xp_err’
xml/apr_xml.c:500: error: ‘apr_xml_parser’ has no member named ‘xp_err’
三、进入 /usr/local/myapache
如果启动的是
/usr/local/xxxx/bin/apachectl【建议】
使用的配置文件应该是/usr/local/xxx/conf/httpd.conf, 启动/usr/sbin/httpd 【默认】
使用的配置文件应该是/etc/httpd/conf/httpd.conf
启动命令
http://httpd.apache.org/docs/2.4/programs/apachectl.html
./apachectl start / status / stop /restart
//这个 有用
iptables -I INPUT -p tcp –dport 8081 -j ACCEPT
如果外网访问不到 那么可能是iptables的问题
iptables -A INPUT -p TCP –dport 80 -j ACCEPT
此时即可访问
刷新iptables配置文件 iptables-save > /etc/sysconfig/iptables