我正在添加ip:
Listen 127.0.0.1:80
Listen xxx.xxx.xxx.xxx:80
重新启动apache时会给我错误。
XAMPP: Error 1! Couldn't start Apache!
XAMPP: Starting diagnose...
XAMPP: Sorry, I've no idea what's going wrong.
XAMPP: Please contact our forum http://www.apachefriends.org/f/
如何使本地主机仅可用于局域网中的2台计算机。
答案 0 :(得分:1)
指定Listen
实际告诉Apache应该托管服务器的端口和IP地址,而不是哪些IP地址可以访问服务器。您要找的是Apache Access Control,在这里您将看到需要启用mod_authz_host
,然后您可以Allow
或Deny
主机和IP地址。< / p>
在httpd.conf中查找以下行:
LoadModule authz_host_module modules/mod_authz_host.so
确保LoadModule
现在转到配置的VirtualHost
并添加以下行:
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
#below add your acceptable IPs
Allow from 127.0.0.0/12.12.12.12
</Directory>
请注意,使用主机名会导致反向DNS查找,因此速度很慢。