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

8 篇文章 0 订阅
1 篇文章 0 订阅

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。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值