0

I use wamp. My PC is in a Lan. everybody in the Lan can see my localhost and I don't want that.

I want to limit people on Lan to just be able to see localhost/site/ but now everybody can see localhost and every files and folder that are in localhost.

How can I solve this?

I edit httpd.conf and change "deny from all" to "deny from none"

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
rezaSefiddashti
  • 134
  • 1
  • 9
  • What version of WAMPServer are you running please? – RiggsFolly Oct 10 '16 at 15:47
  • I use 2.5 version – rezaSefiddashti Oct 11 '16 at 11:40
  • See [this post](http://stackoverflow.com/questions/23665064/project-links-do-not-work-on-wamp-server/23990618#23990618) Setup a VH for localhost and a seperate one for each project. Then you can limit localhost to `Require local` and the others to `Require ip 192.168.1` for example – RiggsFolly Oct 11 '16 at 15:32

3 Answers3

0

Localhost is actually your loopback address which resolves to 127.0.0.1 and this is only accessible from your PC. I think what your trying to ask is to allow IP's from your subnet to access certain directories but not others. If thats the case then to do this you will need to edit your httpd.conf and find the <Directory> section. The below example shows you how to enabled access from any PC with an IP from 192.168.1.0/24 (1-254) and localhost (127.0.0.1) to the following path /var/www/sub/folder/ then deny all.

<Directory /var/www/sub/folder/>
Order allow,deny
Allow from 192.168.1.0/24
Allow from 127
</Directory>

As you can see it firstly allows all from the the config and then deny's everything else. If you wanted access for just your local PC then you would do something like this:

<Directory /var/www/sub/folder/>
Order allow,deny
Allow from 127
</Directory>

This will only allow 127.0.0.1 (Localhost) to access the folder.

You can add multiple Directory settings within the httpd.conf for specific folders, just make sure you restart Apache for the changes to apply.

Kitson88
  • 2,889
  • 5
  • 22
  • 37
0

Knowing the IP address is the main goal here, of course you can deny from specific folder by opening .htaccess file:

<Directory specific_folder/>
Options FollowSymLinks
AllowOverride None
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.0(Replace this IP to allow access)
</Directory>

Let me know if this works for you

Ali Hamra
  • 232
  • 1
  • 8
  • 18
0

I'm not sure what your problem is, but localhost is only available from your own computer. (localhost resolves 127.0.0.1)

In order to display the webpages to other users on your LAN network you can use your LAN IP or a service like xip.io

Deben Oldert
  • 114
  • 1
  • 11