LinuxApache不能启动服务的解决

http://blog.sina.com.cn/s/blog_44c831df0100lfyp.html

今天安装Apache到/usr/local目录下,安装之后不能启动服务,提示未识别的服务,找了找方法记录下:

vi /etc/rc.d/rc.local
增加:/usr/local/httpd/bin/apachectl start

注册为Service
cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
vi httpd
找到:#!/bin/sh
另起一行,增加:
# chkconfig: 345 70 30
# description: Apache

然后注册服务:chkconfig --add httpd
----
启动服务:service httpd start
停止服务:service httpd stop
重新启动:service httpd restart

3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(70);关闭序号(30)。

运行chkconfig --list,httpd在其中

 

mysql设为linux服务(未验证)

cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
chown mysql:mysql -R /usr/local/mysql5/
service mysqld start

 

另外,启动时还提示

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

 

解决:

#vim /usr/local/apache2/conf/httpd.conf (在这里是我安装apache的目录)

找到#ServerName www.example.com:80 把#去掉,再重启apache即可没事了。

另外一种现象一同记下:

bogon:~/webserver/httpd-2.0.59 # /usr/local/apache2/bin/apachectl start
httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
httpd (pid 20183) already running

 

這個問題應該是沒有在 httpd.conf 中設定 ServerName  
vi /usr/local/apache2/conf/httpd.conf


最简单的,修改httpd.conf文件,增加:
ServerName www.example.com:80

再次启动正常!

posted @ 2011-12-30 13:56  haiwei.sun  阅读(2977)  评论(0编辑  收藏  举报
返回顶部