1. 找到xampp根目录下的/xampp/apache/conf/extra/httpd-xampp.conf文件,然后用文档编辑器编辑它,比如notepad++
2. 找到下面列出的这些行,他们表示只能在127.0.0.1/8,即localhost上进行访问:
# Close XAMPP security section here Order deny,allow Deny from all
Allow from ::1 127.0.0.1/8
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
# Close XAMPP sites here Order deny,allow Deny from all
Allow from ::1 127.0.0.1/8
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
将其改为:
# Close XAMPP security section here Order deny,allow Deny from all
Allow from ::1 192.168.0.1/8 127.0.0.1/8
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
# Close XAMPP sites here Order deny,allow Deny from all
Allow from ::1 192.168.0.1/8 127.0.0.1/8
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
192.168.0.1/8 表示IP从192.168.0.1到192.168.0.255被允许访问,即你的局域网IP。
3. 最后重启Apache服务器,让配置生效。
XAMPP启用局域网IP地址访问
最新推荐文章于 2023-02-24 17:35:20 发布