server下apache2.4.*虚拟主机配置Forbidden You don't have permission to access / on this server.
前言:
继前面两节笔记之后,在配置一个虚拟主机时,这中间却遇见了一个问题,这里需要描述做一下笔记,刚刚安装的是Ubuntu server,apt-get下来的apache的版本是2.4.7,之前一直用的是apache2.2的,期间遇见过403错误,只是问题处理的方式方法有些不一样,于是这里就一时没有找到头绪。本文原创博客地址:http://www.cnblogs.com/unofficial官网地址:www.pushself.com)
403:没有权限访问
不说废话直接找主题:
首先我们来回顾一下apache2.2的配置
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
server默认000-default.conf配置文件,在copy的文件后没有发现directory这一部分,搜也没有搜出想要的答案,在apache官网上发现了这一变化。
In this example, all requests are denied.
2.2 configuration:
Order deny,allow
Deny from all
2.4 configuration:
Require all denied
In this example, all requests are allowed.
2.2 configuration:
Order allow,deny
Allow from all
2.4 configuration:
Require all granted
In the following example, all hosts in the example.org domain are allowed access; all other hosts are denied access.
2.2 configuration:
Order Deny,Allow
Deny from all
Allow from example.org
2.4 configuration:
Require host example.org
看到上面的配置文件应该可以看出一部分问题,配置文件的写法有些变化了,需要将配置文件修改为Require all granted。
官网解释:http://httpd.apache.org/docs/2.4/upgrading.html本文原创博客地址:http://www.cnblogs.com/unofficial官网地址:www.pushself.com)
虚拟主机配置步骤:
配置一个ServerName:demo.pushself.com
① 复制一份默认的配置文件
cd /etc/apache2/sites-available
sudo cp 000-default.conf demo.conf
sudo vim demo.conf ServerName demo.pushself.com #新增一句ServerName
ServerAdmin webmaster@localhost
DocumentRoot /wwwroot/demo #修改为你的项目路径
<Directory /wwwroot/demo> #新增权限配置不同于2.2
Require all granted
</Directory>
sudo ln -s /etc/apache2/sites-available/demo.conf /etc/apache2/sites-enabled/demo.conf
sudo service apache2 restart
②我是远程连接的server,所以我需要修改一下客户端的hosts文件,添加一句模拟DNS
192.168.25.107 demo.pushself.com #IP是我的server地址
注意:如果上述配置后还是还是会403 Forbidden,原因是没有index文件,为了解决这个问题,我们可以再配置文件添加一句,新增后记得重启apache
<Directory /wwwroot/demo> #新增权限配置不同于2.2
Options FollowSymLinks Indexes
Require all granted
</Directory>
本文原创博客地址:http://www.cnblogs.com/unofficial官网地址:www.pushself.com)
server下apache2.4.*虚拟主机配置Forbidden You don't have permission to access / on this server.的更多相关文章
- linux下apache2的虚拟主机配置
1,起因 在一星期前吧,大波说既然咱们有了自己的服务器,二级域名了.可以考虑怎样每人一个域名,分别指向我们各自的空间.想法挺好,避免我们个人的东西放在同一主页上.那就做吧 2,第一次尝试 (1)在域名 ...
- 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的版本问 ...
- 蛋疼的 403 Forbidden You don’t have permission to access / on this server.
参考博文: a.http://www.linuxidc.com/Linux/2016-09/134827.htm 这个解释挺好 昨天配置新服务器:以为自己老手 就一步到位结果一直出现 403 For ...
- PHP错误:Forbidden You don't have permission to access / on this server.
今天在测试一个php程序的时候,发现这个问题: Forbidden You don't have permission to access / on this server. 开始的时候我是用http ...
- Forbidden You don't have permission to access / on this server.
原文:Forbidden You don't have permission to access / on this server. Forbidden You don't have permissi ...
- MAMP "403 Forbidden You don't have permission to access / on this server."
2015年01月22日 17:27:31 阅读数:3488 用MAMP搭建本地服务器的时候,设置好ip和端口等属性之后,浏览器访问,报 403错误: Forbidden You don't have ...
- Forbidden You don't have permission to access / on this server. You don't have permission to access /phpmyadmin/ on this server. 解决办法
Forbidden You don't have permission to access / on this server. 解决办法 打开 httpd.conf 文件, 将 # onli ...
- windows环境下,apache虚拟主机配置
在windows环境下,apache从配置文件的相关配置: Windows 是市场占有率最高的 PC 操作系统, 也是很多人的开发环境. 其 VirtualHost 配置方法与 Linux 上有些差异 ...
- apache2.2 虚拟主机配置
一.改动httpd.conf 打开appserv的安装文件夹,找到httpd.conf文件,分别去掉以下两行文字前面的#号. #LoadModule vhost_alias_module module ...
随机推荐
- java多线程系列6 synchronized 加强版 ReentrantLock
ReentrantLock类是可重入.互斥.实现了Lock接口的锁,它与使用synchronized方法和快具有相同的基本行为和语义,并且扩展了其能力.ReenreantLock类的常用方法有: Re ...
- java多线程系列16 线程池
当系统系统规模较小,我们可以不使用线程池.但是当系统到达一定规模,频繁的创建和销毁线程池会消耗很多资源. 合理利用线程池能够带来三个好处. 1降低资源消耗.通过重复利用已创建的线程降低线程创建和销毁造 ...
- 《C#从现象到本质》读书笔记(九)第11章C#的数据结构
<C#从现象到本质>读书笔记(九)第11章C#的数据结构 C#中的数据结构可以分为两类:非泛型数据结构和泛型数据结构. 通常迭代器接口需要实现的方法有:1)hasNext,是否还有下一个元 ...
- using python read/write HBase data
A. operations on Server side 1. ensure hadoop and hbase are working properly 2. install thrift: apt ...
- MFC文件IO和串行化
一. MFC中CFile对象实现了磁盘文档的读写,但是大部分MFC应用程序的IO服务都使用CArchive对象来完成.不管CFile和Archive输入输出的都是二进制数据,非文本数据. int a ...
- iOS逆向工程之Cycript
1.连接设备 打开一个终端,输入指令: iproxy 重新打开一个新的终端,输入指令: ssh -p root@127.0.0.1 这时候会提示输入密码:默认密码为“alpine”.这样就可以连接到设 ...
- 杂七杂八的JavaScript
一.input 焦点定位 1.定位input:(this.$refs.searchInput as HTMLInputElement).focus(); 2.定位search,根据css选择器: ...
- Android NDK学习(四):C/C++层调用JAVA
一.从C/C++层调用JAVA层代码(无参数调用) //在c代码里面调用java代码里面的方法 // java 反射 // 1 . 找到java代码的 class文件 // jclass (*Find ...
- ubuntu下TFTP Server 的安装和使用方法
tftp是一种于1981年在RFC 783中定义的简化的文件传输协议(FTP).小型文件传输协议非常简单,通过少量存储器就能轻松实现 ——这在当时是很重要的考虑因素.所以TFTP被用于引导计算机,例如 ...
- Testing - 软件测试知识梳理 - 理解测试
理解 目的 测试就是要找到关键信息,有关项目和产品的关键决策都是根据这些信息做出. 对产品质量做出总体评估. 找出并报告团队所有可能会对产品价值产生消极影响的问题(但并不意味着能发现所有问题). 重心 ...