Block access to every file in the site but index.htm

I have a site with just one file: index.htm witch have some ajax linked
to php files. I’d like to make thouse php files only accessable via ajax
(post and get) coming from this index file and block access to all files
but the index.htm. Is it possible in Nginx? Thanks.

Posted at Nginx Forum:

On Fri, Feb 18, 2011 at 9:00 AM, atipico [email protected] wrote:

I have a site with just one file: index.htm witch have some ajax linked
to php files. I’d like to make thouse php files only accessable via ajax
(post and get) coming from this index file and block access to all files
but the index.htm. Is it possible in Nginx? Thanks.

location = /index.htm {
root …

}

location / { return 404; }

On 02/18/2011 10:59 AM, Edho P Arief wrote:

location / { return 404; }


nginx mailing list
[email protected]
nginx Info Page
using ajax cannot get correct response either.
you can protect information by COOKIE:

location = /index.htm {
root …
add_header Set-Cookie allow=true;
}
location / {
if ($COOKIE_allow = true ) {…}
return 404;
}

Please, Tony, just to clarify: when you say “protect information by
COOKIE”, are talking about this?
http://nginx.org/pipermail/nginx/2009-June/012857.html
Thanks!

Posted at Nginx Forum:

I think this is the pointed solution, isn’t it?

http://nginx.org/pipermail/nginx/2009-June/012814.html
http://wiki.nginx.org/HttpUserIdModule

Thanks!

Posted at Nginx Forum:

On 02/18/2011 06:15 PM, atipico wrote:


nginx mailing list
[email protected]
nginx Info Page
no, you cannot protect anything in nginx, its just a first step
protection. your server should support session.

and $http_referer needs to be checked.

But how to work with sessions if my first page is a static page? Should
I create a session via Ajax?

Posted at Nginx Forum: