本地主机上的Apache阻止本地主机之外的传入连接

我怎样才能使我的本地Apache安装只能作为http:// localhost /而不是从外部使用连接到networking时使用我的机器的IP?

可以试试:
order deny,allow
allow from 127.0.0.1
deny from all

在.htaccess文件中。 – 我使用类似的设置允许外部网站允许我们的办公室IP访问所有,但要求input其他密码。

将您当前的“听”行改为“Listen 127.0.0.1:80”

http://httpd.apache.org/docs/current/mod/mpm_common.html#listen

最简单的方法是阻止托pipeApache的机器的防火墙中的端口80和443。 这将使外部请求在防火墙被阻止。

其中一些是从httpd.apache.org/docs/2.2/misc/security_tips.htm借用的。

将以下内容添加到httpd.conf中:

  1. 默认限制对所有内容的访问。 这是从“ 默认保护服务器文件 ”:

     <Directory /> Order Deny,Allow Deny from all </Directory> 
  2. 然后,只允许在您希望的区域访问。 在这个例子中, /var/www/html是我的DocumentRoot:

     DocumentRoot "/var/www/html" <Directory /var/www/html/> Order Deny,Allow Allow from 127.0.0.1 </Directory>