正在检查登录状态... | 繁體中文 | 设为首页 | 加入收藏
点击:302 | 评论:0 | 辅助功能: 复制 | 打印 | 字体: | |

linux下如何把apache作为服务运行?

作者: 蓝天下云层上 发表于 最后更新于
版权声明:转载请征求作者同意,转载时必以超链接形式标明文章原始出处和作者信息及版权声明。
/blog/weblog-20555-1.html
2010-10-18

  其实在源码里已经有启动的脚本,我们要修改下即可,把Apache加入系统SysV服务中来。
在源码httpd-2.x.x/build/rpm中存在httpd.init
cp httpd-2.x.x/build/rpm/httpd.init /etc/init.d/httpd

2010-4-19

  长久以来linux下apache的启动是在/etc/rc.d/rc.local文件中添加/opt/www/bin/apachectl start来实现开机启动。

  现在用如下方法可以把apache放入服务中运行。

第一步
cp bin/apachectl /etc/init.d/httpd

第二步
vi /etc/init.d/httpd
加入:
# Startup script for the Apache Web Server
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: httpd
# pidfile: /opt/www/log/httpd.pid
# config: /opt/www/conf/httpd.conf

第三步
chmod 755 /etc/init.d/httpd
chkconfig --add httpd
chkconfig httpd on

然后就可以使用如下指命启动、停止、重启apache了
service httpd start
service httpd stop
service httpd restart




此日志的引用通告 URL:
http://www.imx365.net/blog/tb.cgi/20555

其实我一直都不知道您在想些什么,有什么感触。说真的,您的评论对于我来说很重要...

还没有人评论过

发表评论
  • (地址不公开)

(访客)