百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> CentOS6.x编译安装LAMP(2):编译安装 Apache2.2.22教程
分享文章到:

CentOS6.x编译安装LAMP(2):编译安装 Apache2.2.22教程

发布时间:01/15 来源: 浏览: 关键词:
本文章来给大不介绍一个朋友的CentOS6.x编译安装LAMP教程,这个单独编译安装 Apache2.2.22,后来我们有安装mysql,php等等操作了。

#切换到源码目录

 代码如下

cd /usr/local/src/httpd-2.2.22

#生成configure

 ./configure --prefix=/usr/local/apache --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-ssl=shared --enable-headers=shared --enable-rewrite=shared --enable-static-support --with-mpm=prefork

#编译

 代码如下

make && make install

编译参数解释:

--prefix=/usr/local/apache :指定安装目录
--with-included-apr : 在编译时强制使用当前源代码中绑定的APR版本
--enable-so : 允许运行时加载DSO模块(注意:so模块需静态编译)
--enable-deflate=shared : 将deflate模块编译为DSO
--enable-expires=shared : 将expires模块编译为DSO
--enable-ssl=shared : 将ssl模块编译为DSO
--enable-headers=shared : 将headers模块编译为DSO
--enable-rewrite=shared : 将rewrite模块编译为DSO
--enable-static-support : 使用静态连接(默认为动态连接)编译所有二进制支持程序
--with-mpm=prefork : 使用prefork形式的mpm

更详细的编译参数解释:http://lamp.linux.gov.cn/Apache/ApacheMenu/programs/configure.html

 代码如下

cp ./build/rpm/httpd.init  /etc/init.d/httpd  #使用init脚本管理httpd
chmod 755 /etc/init.d/httpd  #增加执行权限
chkconfig --add httpd  #添加httpd到服务项
chkconfig httpd on  #设置开机启动

mv /etc/httpd  /etc/httpd_old  #移走旧的httpd文件夹
ln -s /usr/local/apache  /etc/httpd  #建立httpd的软链接,
#到时候,Apache的配置文件路径为 /etc/httpd/conf/httpd.conf,其实真实路径为 /usr/local/apache/conf/httpd.conf

ln -sf /usr/local/apache/bin/httpd  /usr/sbin/httpd  #设置软链接以适应init脚本
ln -sf /usr/local/apache/bin/apachectl  /usr/sbin/apachectl

rm -rf /var/log/httpd/
ln -s /usr/local/apache/logs  /var/log/httpd

groupadd apache  #添加Apache用户组及用户
useradd -g apache apache

配置防火墙,开启80端口

 代码如下

vim /etc/sysconfig/iptables

#添加如下规则到22端口这条规则的下面即可

 代码如下

 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

#重启防火墙

 代码如下

 /etc/init.d/iptables restart  # 或  service iptables restart

启动Apache

 代码如下

/etc/init.d/httpd start  # 或  service httpd restart

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有7人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板