Welcome! Log In Create A New Profile

Advanced

Plain PHP app in subdirectory

Posted by YUemwsdl3 
Plain PHP app in subdirectory
November 30, 2011 01:02AM
I have a site that's mostly static HTML. However, it has a few subdirectories containing plain PHP apps. One of those apps is working: good and bad URLs lead to the expected results.

However, one PHP app isn't working. This app (working fine with Apache) has URLs like this:

/failing_app/ABC1234

I use an .htaccess file to have Apache map that to index.php?q=ABC1234 and I'd like nginx to do something similar. That site also has URLs like:

/failing_app/virtual_subdirectory

As above, the .htaccess file maps that to index.php?q=virtual_subdirectory

This has kinda sorta worked with some nginx settings, but the stopper problem is that with the current configuration I'm prompted to download a settings file if I try to access that settings file directly. So, if I go to:

/failing_app/settings.php

I'm presented with a dialog to download settings.php. Needless to say, I don't want people to be able to download my settings file.

What I'd like is a recipe for setting up a similar plain PHP app in a subdirectory. A similar app in the root of a different domain works, but so far this similar app isn't working in the subdomain of another site.

The app that works is like this:

location = /working_app/publicly_accessible1.php {
fastcgi_pass phpcgi;
}
location = /working_app/publicly_accessible2.php {
fastcgi_pass phpcgi;
}
location ~* ^/working_app/.+\.php$ {
return 404;
}

The one that fails is like this:

location = /failing_app/publicly_accessible1.php {
fastcgi_pass phpcgi;
}
location = /failing_app/publicly_accessible2.php {
fastcgi_pass phpcgi;
}
location ~* /failing_app/[a-zA-Z0-9](7) {
try_files $uri /failing_app/index.php?q=$uri&$args;
}
location ~* ^/failing_app/.+\.php$ {
return 404;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 153
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready