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


/*參考

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>

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM