Forbidden you don‘t have permission to access this resource Apache/2.4.46(Win64)PHP/7.3.21 Server at

本文档介绍了在手机连接电脑上运行的Apache服务器时遇到的问题及解决方案。主要涉及修改Apache的httpd.conf和httpd-vhosts.conf配置文件,包括更改Directory权限设置和VirtualHost配置,以允许手机访问。

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

/*参考

https://blog.csdn.net/A1344714150/article/details/95341261

https://bbs.csdn.net/topics/390904273?list=23494857

*/

1.用手机连接wapmserver中的apache时出现的问题(手机连接电脑这个服务器)

2.解决方法

(1)手机与电脑连接同一个wife,但是不要搞错手机应该连接的ip地址与端口号了。

用的是192.168.1.145这个ip地址,此ip地址是你连接的路由器(wife)分配给你无线网卡,产生的地址

(2)查阅博客帖子,发现这个问题常规的解决办法是修改(Apache里的)httpd.conf中的两处配置。

先将

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>


修改为

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

接着将

DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options +Indexes +FollowSymLinks +Multiviews
 
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
#    AllowOverride all
 
    #
    # Controls who can get stuff from this server.
    #
 
#   onlineoffline tag - don't remove
#    Require local
   AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

修改为

DocumentRoot "E:\wamp64\www"
<Directory "E:\wamp64\www">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

之后你还需要将httpd-vhosts.conf(也是Apache中的)

<VirtualHost _default_:80>
 #DocumentRoot "${SRVROOT}/htdocs"
 DocumentRoot "d:/www"
 #ServerName www.example.com:80
 </VirtualHost>

修改为

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  #DocumentRoot "${INSTALL_DIR}/www"
DocumentRoot "E:\wamp64\www"      #主要修改红色字体部分
  <Directory "E:\wamp64\www">

    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

幽香飞狐

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值