当前位置: > CentOS > CentOS故障 >

Centos下安装配置Apache过程中可能出现的错误

时间:2015-11-04 18:46来源:linux.it.net.cn 作者:IT

httpd:unrecognized service

//将apache安装为系统服务
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
//然后 vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh下面)
chkconfig: 2345 50 90
description: Activates/Deactivates Apache Web Server
//最后,运行chkconfig把Apache添加到系统的启动服务组里面:
chkconfig --add httpd
chkconfig httpd on
//然后再service httpd start

httpd: Could not reliably determine the server’s fully qualified domain name

//用记事本打开 httpd.conf
//将里面的 #ServerName localhost:80 注释去掉即可。
//再执行 httpd
//然后可以通过浏览器访问 http://localhost:80 ,如果页面显示 “It works!” ,即表示apache已安装并启动成功。

You don’t have permission to access / on this server

原来是因为我的虚拟主机目录为非apache安装目录下的htdocs,所以违反了apache对默认对网站根访问权限。  apache的默认虚拟主机根目录地址为../Apache Software Foundation/Apache2.2/htdocs 目录下,需要对httpd.conf文件进行修改才能指向其他目录。 在httpd.conf文件下找到这段:

<span style="font-size: x-small;">#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory></span>

将之修改为

<span style="font-size: x-small;"># 允许指向外部的目录进行访问
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory></span>

重启httpd。

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容