Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been attempting to restrict access to an internet connected apache instance. My router has a port forward to the machine that is running apache. Don't know if this makes a difference.

Anyway I want to restrict it to LAN access only for the moment, and I want to use htaccess so that later I can enable visitors based on specific IPs. It is a dev server that I want my clients to be able to remotely preview, but not anyone else.

I've tried the instructions here: http://corz.org/serv/tricks/htaccess.php which explain to do this

order deny,allow
deny from all
allow from 192.168.1

In my .htaccess file, but this doesn't work, I can still access it from outside the lan. I'm trying it from my phone's 3g and it works.

If I change the order to something like

Order Deny,Allow
Deny from all
Allow from 192.168.1

(remove the comma) as per the apache docs here: http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow and the page still allows access on my phone and on the local.

Any ideas?

share|improve this question
    
Can you please post the contents of "error.log" so we can examine and pinpoint the issue? –  U4iK_HaZe Aug 30 '11 at 4:23
    
Or the access log if there aren't any errors. And don't "censor" any IP addresses if/when you do post them. They are the most important bit of this problem. –  Ladadadada Dec 10 '11 at 11:00
add comment

1 Answer

Check if you have AllowOverride All to make sure that your .htaccess is not ignored.

share|improve this answer
    
What config file should this be in? –  Jason Aug 30 '11 at 23:50
    
The <Directory> directive for your DocumentRoot in the main config file httpd.conf. –  quanta Aug 31 '11 at 2:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.