wamp环境 解决本地正常访问,局域网403不能访问项目的问题!!

文章讲述了如何修改WAMP服务器的httpd.conf和httpd-vhosts.conf配置文件以允许特定的Override选项和访问权限。在httpd.conf中将<Directory>块的权限设置为允许所有。在httpd-vhosts.conf中创建了一个VirtualHost,定义了ServerName、DocumentRoot,并设置了访问控制,只允许特定的本地IP地址访问。此外,还指导了在访问端电脑的hosts文件中添加条目以实现域名访问。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1,找到配置文件:httpd.conf

D:\wamp64\bin\apache\apache2.4.46\conf

大约在250行左右

<Directory />
    AllowOverride none
    Require all denied
</Directory>

修改为:

<Directory />
    AllowOverride none
    Require all granted
</Directory>

2,配置httpd-vhosts.conf

D:\wamp64\bin\apache\apache2.4.46\conf\extra

<VirtualHost *:80/myproject>
    ServerName a.com
    DocumentRoot C:/WampServer/www/myproject
    <Directory  "C:/WampServer/www/myproject">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
            Require local
            Require ip 192.168.1.4      服务器地址
            Require ip 192.168.1.250    访问端地址

    </Directory>
</VirtualHost>

3,访问端电脑修改hosts

C:\Windows\System32\drivers\etc

192.168.1.4   a.com

4,访问  a.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值