How can I make it that my local Apache installation works only as http://localhost/ and never from outside like using the IP of my machine when connected to a network please?
4 Answers
Could try:
order deny,allow
allow from 127.0.0.1
deny from all
in a .htaccess file. - I use a similar setup to allow an external website to allow all access from our office IP, but ask for a password from any other.
- 151
Change your current "Listen" line to "Listen 127.0.0.1:80"
http://httpd.apache.org/docs/current/mod/mpm_common.html#listen
- 4,868
The easiest way would be to block ports 80 and 443 in the firewall for the machine that is hosting Apache. This would make external requests get blocked at the firewall.
- 86
Some of this is borrowed from httpd.apache.org/docs/2.2/misc/security_tips.htm.
Add the following to httpd.conf :
Restrict access to everything by default. This is from "Protect Server Files by Default":
<Directory /> Order Deny,Allow Deny from all </Directory>Then, allow access only in those areas you wish. In this example,
/var/www/htmlis my DocumentRoot:DocumentRoot "/var/www/html" <Directory /var/www/html/> Order Deny,Allow Allow from 127.0.0.1 </Directory>
- 24,361
- 42
- 136
- 188