Forum: NGINX Single php file location match

Posted by drewrockshard (Guest)
on 2010-03-05 05:34
(Received via mailing list)
How would I go about running a PHP file that is only matched by the 
request of that file?  Meaning, how can someone request a file and nginx 
run this configuration ONLY when this PHP file is requested.

Here is what I have so far:


location / {
            root   /www/default/;
            try_files $uri $uri/ /index.php?q=$uri&$args;
            index  index.php;
        }

location /status.php {
            #allow 192.168.1.0/24;
            deny all;
            #allow all;
            root   /www/default/;
            try_files $uri $uri/ /index.php?q=$uri&$args;
            index status.php;
}


Basically, I'll be setting up rules to only allow a local network 
request, but only for status.php.  So how do I go about allowing this 
one network to status.php?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,60179,60179#msg-60179
Posted by Igor Sysoev (Guest)
on 2010-03-05 09:12
(Received via mailing list)
On Thu, Mar 04, 2010 at 11:34:19PM -0500, drewrockshard wrote:

> 
> Basically, I'll be setting up rules to only allow a local network request, but only for status.php.  So how do I go about allowing this one network to status.php?
location = /status.php {
             #allow 192.168.1.0/24;
             deny all;
             #allow all;
             root   /www/default/;
             fastcgi_pass   ...
             include        fastcgi.conf;
}


--
Igor Sysoev
http://sysoev.ru/en/
Posted by drewrockshard (Guest)
on 2010-03-05 14:24
(Received via mailing list)
Igor,

Thanks for the update!  This resolved it.  So, after I had submitted my 
post I did end up using the equal sign ("="), which worked, however, it 
wasn't working, but after inserting the fcgi stuff, it worked.

Thanks again!

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,60179,60301#msg-60301
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.