Welcome! Log In Create A New Profile

Advanced

block access to a file !!

June 06, 2012 09:22AM
Hi,
it must be a piece of cake but i can not find a soloution...

the problem is " location admin.php". you can check it below...


i just want to allow access to admin.php to some ip address and deny others.



if i remove allow line from it it deny all; but when I add allow line it dont work ..
please help me...
I tried too many syntax but no success.
i even add root and index to this location but browser prompt to download my php file..

please help



here 's my server section of config...very simple
server {
listen 80;
server_tokens off;
server_name www.mysite.com;
access_log /var/log/nginx/mysite.log;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;


location / {
root /usr/share/nginx/www;
index index.php;
client_max_body_size 8m;
client_body_buffer_size 256k;
}
location = /50x.html {
root /usr/share/nginx/html;
}
location = /404.html {
root /usr/share/nginx/html;
}
location ~ /\.ht {
deny all;
}
location ~ \.php$ {
root /usr/share/nginx/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
set $ssl off;
if ($ssl_protocol != "" ) {
set $ssl on;
}
fastcgi_param HTTPS $ssl;
}

location ~ admin.php {
allow 217.66.196.193;
deny all;
}
Subject Author Posted

block access to a file !!

torajx June 06, 2012 09:22AM

Re: block access to a file !!

Francis Daly June 06, 2012 09:42AM

Re: block access to a file !!

torajx June 06, 2012 09:50AM

Re: block access to a file !!

Francis Daly June 06, 2012 10:32AM

Re: block access to a file !!

torajx June 09, 2012 02:44AM

Re: block access to a file !!

torajx June 10, 2012 10:53AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 54
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready