linux下如何把apache作为服务运行?
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
其实在源码里已经有启动的脚本,我们要修改下即可,把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
其实我一直都不知道您在想些什么,有什么感触。说真的,您的评论对于我来说很重要...
还没有人评论过
发表评论

(访客)