问题解决:Apache: You don't have permission to access / on this server

虚拟主机(Virtual Host)是指在一个机器上运行多个网络站点 (比如:www.company1.com和www.company2.com)。 如果每个网络站点拥有不同的IP地址,则虚拟主机可以是"基于IP"的; 如果只有一个IP地址,也可以是"基于主机名"的, 其实现对最终用户是透明的。具体细节可以查看Apache官方说明

一. “基于主机名”虚拟主机的配置

Listen 81
  NameVirtualHost *:81
  <VirtualHost *:81 >
       ServerAdmin [email protected]
       DocumentRoot  yourRoot
      <Directory "yourRoot ">
       Options FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
      </Directory>
  </VirtualHost>

配置说明:

81 : 为端口号,可以是其他现在系统未用的端口

yourRoot : linux下格式形如: /export/www    注意最后没有"/"

将上面的添加到apache的配置文件httpd.conf(linux下在/usr/local/apache2/conf/,视具体情况而定),然后重新启动Apache .

注意:

要配置基于主机名的虚拟主机,必须保留原有的80端口。二. 查看配置是否成功

在浏览器中输入 http://localhost:81 查看是否配置成功。

 三. 常见问题常见解决方案

当在浏览器中查看配置成功与否出现问题时,可优先到Apache官方网站的FAQ 上或用搜索引擎搜索你的问题。

我这里就最常见403问题:

Forbidden

You don‘t have permission to access / on this server.

提供几种常见的解决方法:

1.按上面的配置正确,特别是:

Order allow,deny
       Allow from all

2. 确保youRoot文件夹下有index.html文件(或名为index而后缀为其他形式(如.jsp .php等)的文件) ,因为Apache默认以index.html为网站首页,如果没有这个文件就会出现上面的403错误。

注:如果你想以其他形式的文件(如:index.jsp或index.php等)作为出现的网页,可将Apache的配置文件中的:

<IfModule dir_module>
       DirectoryIndex index.html
   </IfModule>
   改为(如你想用index.jsp):<IfModule dir_module>
       DirectoryIndex index.html index.jsp
   </IfModule>

如果需要浏览该文件夹下的内容,可以在</Directory>前添加:

Options Indexes

就可以了。
  3. 针对linux用户,windows或其他用户一般没这种情况。linux系统中一般会自带apache,在修改了配置文件后,最好到安装Apache的目录下重启Apache。

问题解决:Apache: You don't have permission to access / on this server

时间: 2024-08-29 17:14:07

问题解决:Apache: You don't have permission to access / on this server的相关文章

Apache: You don&#39;t have permission to access / on this server

当我们需要使用Apache配置虚拟主机时,有可能会出现这个问题:Apache: You don't have permission to access / on this server # 同IP不同域名 # Listen for virtual host requests on all IP addresses NameVirtualHost *:8080 <VirtualHost *:8080> DocumentRoot "D:/lamp/phpweb/full" Se

Apache 2.4权限设置( you don&#39;t have permission to access / on this server Apache2.4)

摘要 you don't have permission to access / on this server Apache2.4 Apache 从2.2升级到 Apache2.4.x 后配置文件 httpd.conf 的设置方法有了大变化,以前是将 deny from all 全部改成 Allow from all 实现外网访问,现在是将 Require all denied 以及 Require local 都该为 Require all granted 就可以了. .htaccess 如果

Apache-You don&#39;t have permission to access / on this server. Apache, win 7

在win7环境下,apche报出You don't have permission to access / on this server.禁止访问,应该如何解决呢?可以试试下面的方法 第一:寻找配置文件:apache\apache2.2.22\conf\httpd.conf (修改配置文件之前,记得先做好备份,以免方案不对,影响原来的配置) 第二:用编辑器打开,寻找: #LoadModule rewrite_module modules/mod_rewrite.so 第三:删除本行开头的“#”,

Linux Centos7 Apache 访问 You don&#39;t have permission to access / on this server.

折腾了很久,今天才找到了最正确的答案.感言真不容易. 百度出来的99%都是采集的内容,全都是错误的. You don't have permission to access / on this server. 百度出的解决方法: 1)关闭selinux .坑,服务器根本就没开启selinux 2)修改 httpd.conf 中的 allow from all!坑,Apache都2.4+,根本就不存在 allow from all ,现在改为了  Require all granted! 3)修改

apache 访问默认页面及 you don&#39;t have permission to access / on this server”问题

问题一: 说明http服务器没有问题  , 找到文件所在的位置   rm -rf /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html  删掉即可. 问题二: 1. 通过apachectl -t 检测配置文件也没有问题 2.查看.conf 文件的   Allow from all 3.查看http.conf 文件中指定的用户和组的访问权限  解决链接          http://wiki.apache.org/httpd/13P

Apache(httpd) 报错You don&#39;t have permission to access /on this server.

项目需要,增加个访问端口,指向不同目录. 但是一直报"You don't have permission to access /on this server."错误 配置文件语法检查: #/etc/init.d/httpd configtest 或 apachectl -t 直接输入:/etc/init.d/httpd 会新显示选项 [[email protected] ~]# /etc/init.d/httpd  Usage: httpd {start|stop|restart|co

Apache 环境提示You don&#39;t have permission to access / on this server.

(本人只是在本地环境下遇到这个问题能这么处理,不确定服务器下如此修改是否会有安全问题) 找到apache配置文件,一般路径为 apache/httpd.conf ,搜索 "Deny from all",都修改为 allow from all ,如下所示 <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow allow from all</Directory> .....

redhat centos apache 403 错误 Forbidden You don&#39;t have permission to access / on this server

redhat centos apache 403 错误 centos7 apache2.2.34源码包安装成功,确认进程已启动( ps -le | grep httpd) ,防火墙已关闭,但访问时报错: Forbidden  You don't have permission to access / on this server 原因为:安装目录/conf/httpd.conf配置文件中 User deamon Group deamon 选项没有修改,上述配置为默认配置,将其修改为 User t

Apache Version: 2.4.33 提示You don&#39;t have permission to access / on this server 的错误

需要修改 apache的配置文件  httpd.conf 和 httpd-chosts.conf 这两个配置文件 1.将httpd.conf 中的denied 修改为 granted 2 .把 httpd-chosts.conf 中的require local 修改为 require all granted 然后就可以了 Apache Version: 2.4.33 提示You don't have permission to access / on this server 的错误 原文地址:h