Apache2.4.x版wampserver本地php服务器如何让外网访问及启用.htaccess
作者:mdxy-dxy 时间:2023-11-04 09:27:00
Apache 从2.2升级到 Apache2.4.x 后配置文件 httpd.conf 的设置方法有了大变化,以前是将 deny from all 全部改成 Allow from all 实现外网访问,现在是将 Require all denied 以及 Require local 都该为 Require all granted 就可以了。
.htaccess 如果不起作用将 LoadModule rewrite_module modules/mod_rewrite.so 前面的注释(#)去掉就可以了。
下面看一下 Apache2.4 的变化:(官方英文说明)
所有的请求都被拒绝
2.2上的配置
Order deny,allow
Deny from all
2.4上的配置
Require all denied
所有请求都是允许的
2.2上的配置
Order allow,deny
Allow from all
2.4上的配置
Require all granted
在域中的所有主机都可以访问example,所有其他外网主机的访问被拒绝
2.2上的配置
Order Deny,Allow
Deny from all
Allow from example.org
2.4上的配置
Require host example.org
要想外网访问将 Require local 该为 Require all granted 。
经常会用到的:
Require all denied
Require all granted
Require host xxx.com
Require ip 192.168.1 192.168.2
Require local
举例说明
仅允许IP:192.168.0.1 访问
Require all granted
Require ip 192.168.0.1
仅禁止IP:192.168.0.1访问
Require all granted
Require not ip 192.168.0.1
允许所有访问
Require all granted
拒绝所有访问
Require all denied
默认是 Require local 仅允许本地访问。
还有好多变化,可以去官方说明详细看一下,不过只有英文版的。软件变化无常,建议大家升级前详细阅读官方更新文档,以免来个措手不及。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
JS实现拖动模糊框特效
![](https://img.aspxhome.com/file/2023/0/55910_0s.gif)
go doudou应用中使用注解示例详解
![](https://img.aspxhome.com/file/2023/3/105103_0s.png)
PHP基础用法讲解及phpinfo();演示
![](https://img.aspxhome.com/file/2023/3/55373_0s.jpg)
学会迭代器设计模式,帮你大幅提升python性能
教你快速掌握一些方便易用的SQL语句
浅析MySQL内存的使用说明(全局缓存+线程缓存)
python3获取文件中url内容并下载代码实例
导入tensorflow:ImportError: libcublas.so.9.0 报错
![](https://img.aspxhome.com/file/2023/7/68257_0s.jpg)
.Net中控件的命名规则
Python多继承原理与用法示例
![](https://img.aspxhome.com/file/2023/5/105335_0s.png)
python模拟菜刀反弹shell绕过限制【推荐】
JavaScript实现动态时钟效果
浅谈keras 模型用于预测时的注意事项
oracle查询重复数据和删除重复记录示例分享
python基础入门之字典和集合
![](https://img.aspxhome.com/file/2023/4/65144_0s.png)
NodeJs Express路由使用流程解析
Git如何合并多次提交
![](https://img.aspxhome.com/file/2023/3/132353_0s.png)
python脚本监控Tomcat服务器的方法
![](https://img.aspxhome.com/file/2023/2/77042_0s.png)
Python+DeOldify实现老照片上色功能
![](https://img.aspxhome.com/file/2023/3/131403_0s.jpg)