编译apache

搞不清楚以来关系,太他妈的复杂了。

先编译吧,反正实验阶段,除了问题我打不了重新编译。

现在用编译参数如下:

[root@shy-centos httpd-2.2.21]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-vhost-alias --enable-http --enable-static-htpasswd --enable-nonportable-atomics --enable-threads --enable-speling=shared


make install显示的安装位置:

Installing configuration files
mkdir /usr/local/apache2/conf
mkdir /usr/local/apache2/conf/extra
mkdir /usr/local/apache2/conf/original
mkdir /usr/local/apache2/conf/original/extra
Installing HTML documents
mkdir /usr/local/apache2/htdocs
Installing error documents
mkdir /usr/local/apache2/error
Installing icons
mkdir /usr/local/apache2/icons
mkdir /usr/local/apache2/logs
Installing CGIs
mkdir /usr/local/apache2/cgi-bin
Installing header files
Installing build system files
Installing man pages and online manual
mkdir /usr/local/apache2/man
mkdir /usr/local/apache2/man/man1
mkdir /usr/local/apache2/man/man8
mkdir /usr/local/apache2/manual
make[1]: Leaving directory `/usr/src/LAMP源码/httpd-2.2.21'
[root@shy-centos httpd-2.2.21]#


设置apache自启动:

cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd 拷贝成功

chkconfig --add httpd 额 出错了 提示说 httpd 服务不支持 chkconfig

看了这篇帖子:http://hi.baidu.com/zhishitiantang/blog/item/fc92e001084c30067bec2c9c.html 这问题才解决的

解决方法:编辑/etc/init.d/httpd文件,在第一行#!/bin/sh下面添加两行

#chkconfig:2345 10 90
#descrption:Activates/Deactivates Apache Web Server

然后保存关闭

再次运行chkconfig --add httpd 成功

接着把它设置为自动启动 chkconfig httpd on





此时,在输入 service httpd start 来启动httpd服务




Could not reliably determine the server's fully qualified domain name,using ::1 for ServerName

这个异常,虽然不影响apache运行(至少我还没感觉到有影响),但是总觉得很不爽。

于是找到配置文件看了下,有个ServerName被#注释掉了


只要把/conf/httpd.conf配置文件中ServerName前面的#注释符号去掉就可以了



OK 运行正常了


最后一步,防火墙设置里面放行www,别人即可通过你的IP来访问。


附注:

1.如果遇到以下错误,

[root@shy-centos ~]# service httpd start
正在启动 httpd:httpd: Syntax error on line 216 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib/httpd/modules/libphp5.so into server: /usr/lib/httpd/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied [失败]

只需要执行setenforce 0即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值