我在Amazon Linux AMI版本2012.03上安装了apache2。 我能够手动启动它就好了,没有任何错误使用/etc/init.d/httpd start 。 但是,机器启动时不会自动启动。
看来,一切都已正确configuration在我的rc * .d目录中。 find /etc/rc.d -name "*httpd*" | xargs ls -l find /etc/rc.d -name "*httpd*" | xargs ls -l :
-rwxr-xr-x 1 root root 3371 Feb 16 2012 /etc/rc.d/init.d/httpd lrwxrwxrwx 1 root root 15 Apr 14 2012 /etc/rc.d/rc0.d/K15httpd -> ../init.d/httpd lrwxrwxrwx 1 root root 15 Apr 14 2012 /etc/rc.d/rc1.d/K15httpd -> ../init.d/httpd lrwxrwxrwx 1 root root 15 Apr 14 2012 /etc/rc.d/rc2.d/K15httpd -> ../init.d/httpd lrwxrwxrwx 1 root root 15 Apr 14 2012 /etc/rc.d/rc3.d/K15httpd -> ../init.d/httpd lrwxrwxrwx 1 root root 15 Apr 14 2012 /etc/rc.d/rc4.d/K15httpd -> ../init.d/httpd lrwxrwxrwx 1 root root 15 Apr 14 2012 /etc/rc.d/rc5.d/K15httpd -> ../init.d/httpd lrwxrwxrwx 1 root root 15 Apr 14 2012 /etc/rc.d/rc6.d/K15httpd -> ../init.d/httpd
我知道我可以把/etc/init.d/httpd start命令放到/etc/rc.local ,但这不是一个解决方法吗? 为什么不是自动启动? 在rc * .d目录中的其他东西在启动时(mongod,postfix等)启动就好了。 谢谢!
使用chkconfig来pipe理您希望启动此服务的运行级别。
通常chkconfig httpd在做这个工作。
你没有任何“S”链接。 所有的“K”只closures。 添加具有相同名称的链接,只需将Kreplace为S.
“通常,系统启动以字母”S“开头的命令并停止以字母”K“开始的命令。以字母”K“开头的命令仅在系统将运行级别从更高以字母“S”开头的命令在所有情况下运行。
如果使用chkconfig,请参阅“man chkconfig”。 对于你的情况:
chkconfig --level 2345 httpd on
应该做。