Linux下让编译安装的Apache自动启动

1. 在/etc/rc.d/init.d/rc.local中增加启动apache的命令,例如:/usr/local/httpd/bin/apachectl start

2. 将apache注册为系统服务

首先将apachectl命令拷贝至/etc/rc.d/init.d目录下,改名为httpd

cp  /usr/local/httpd/bin/apachectl   /etc/rc.d/init.d/httpd

使用编辑器打开httpd文件,并在第一行#!/bin/sh下增加两行文字如下

# chkconfig: 35 70 30
# description: Apache

接着注册该服务

chkconfig –add httpd

service httpd start

chkconfig httpd on

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: