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

转自:http://blog.csdn.net/crazyboy2005/article/details/4768928

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

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

Listen
  NameVirtualHost *:
  <VirtualHost *: >
       ServerAdmin example@company.com
       DocumentRoot  yourRoot
      <Directory "yourRoot ">
       Options FollowSymLinks
       AllowOverride None
       Order allow,deny
       Allow from all
      </Directory>
  </VirtualHost>
 配置说明:

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

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的更多相关文章

  1. Apache: You don't have permission to access / on this server

    当我们需要使用Apache配置虚拟主机时,有可能会出现这个问题:Apache: You don't have permission to access / on this server # 同IP不同 ...

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

    虚拟主机(Virtual Host)是指在一个机器上运行多个网络站点 (比如:www.company1.com和www.company2.com). 如果每个网络站点拥有不同的IP地址,则虚拟主机可以 ...

  3. Mac apache You don't have permission to access / on this server.

    在mac下配置完apache和php环境后,通过localhost访问页面,出现403Forbidden.页面提示: Forbidden You don't have permission to ac ...

  4. apache You don't have permission to access / on this server.无权访问

    环境:ubuntu16.4 apache2 原因:修改了apache web项目路径 解决: 1. 修改 /etc/apache2/sites-available/000-default.conf 文 ...

  5. Apache提示You don't have permission to access / on this server问题解决

    测试时遇到将一本地目录设置为一apache的虚拟主机,在httpd-vhosts.conf文件中进行简单设置,然后在hosts文件中将访问地址指向本地,启动apache,进行访问,却出现了You do ...

  6. apache出现You don’t have permission to access / on this server问题的解决

    今天在部署一个系统时,在apache中新开了一个VirtualHost,然后设置了DocumentRoot,等访问时却提示“You don’t have permission to access / ...

  7. php多站点配置以及Forbidden You don't have permission to access / on this server问题解决

    php多站点配置以及Forbidden You don't have permission to access / on this server问题解决 一.总结 一句话总结:我的问题是php的版本问 ...

  8. apache出现You don't have permission to access / on this server. 提示

    今天在新的linux上跑原来的代码,使用的虚拟主机的模式进行操作.几个相关的网站放在一个文件里,想法是通过网站列出的目录进行相应的网站进行操作.一切设置完成后,在浏览器中运行出现在You don't ...

  9. WampServer phpadmin apache You don't have permission to access

    1.Forbidden You don't have permission to access / on this server. 后来咨询了一下朋友(php高手),说修改一下php的配置文件http ...

随机推荐

  1. 项目中jquery插件ztree使用记录

    最近公司要求做一个关于后台的管理系统.在这个mvvm模式横行的年代,虽然这里用jquery做项目可能有点不符合时代的潮流,但是管他呢,能做出来先在说呗(公司以后要改用angular或者vue来统一前端 ...

  2. apue第17章笔记

    unix domain socket 关闭socket并不会删除文件,重复bind会失败.所以在bind之前要unlink该文件. open服务器的实现只是简单地看了一下,大致上就是通过unix do ...

  3. Hibernate对象的状态转换

    Hibernate中的实体对象可以分为三种状态:Transient(临时).Persistent(持久).Detached(游离) Transient 用new创建出对象,这些对象还没有与数据库发生任 ...

  4. Ubuntu下环境变量该写进哪个文件里

    Linux中环境变量包括系统级和用户级,系统级的环境变量是每个登录到系统的用户都要读取的系统变量,而用户级的环境变量则是该用户使用系统时加载的环境变量. 所以管理环境变量的文件也分为系统级和用户级的. ...

  5. nginx-404与fastcgi_intercept_errors指令

    nginx-404与fastcgi_intercept_errors指令 fastcgi_intercept_errors语法:fastcgi_intercept_errors on|off 默认值: ...

  6. [转]使用popBackStack()清除Fragment

    Clear back stack using fragments up vote88down votefavorite 27 I ported my Android app to honeycomb ...

  7. codevs 1060 搞笑运动会 dp

    1060 搞笑世界杯 Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codevs.cn/problem/1060/ Description ...

  8. 《python学习手册》第34章 异常对象

    基于字符串的异常 python在2.6之前可以使用字符串来定义异常,并且是通过对象标识符来匹配的(即通过is 而不是==) myexc = "My excetion string" ...

  9. hihocoder 1519 : 逃离迷宫II

    题目链接 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi被坏女巫抓进里一间有N x M个格子组成的矩阵迷宫. 有些格子是小Hi可以经过的,我们用'.'表示:有些格 ...

  10. Ext NumberField使用

    Ext.onReady(function(){ Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget="side"; v ...