Welcome! Log In Create A New Profile

Advanced

Question about nested locations / PHP.

March 09, 2012 05:14PM
Not sure if this is the right place to post this; apologies in advance if it is!

I'm having a bit of trouble with nested locations and PHP. I have a setup where I want all PHP files to go through fastcgi, and have an expiry of epoch. However, one particular PHP file is used to generate CSS stylesheets, and I want this file to have an expiry of 30 days. My current code looks like this:

location ~ \.php$
{
location ~ /css.php
{
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}

expires epoch

// Fastcgi stuff...
}

I've tried various combinations (having the nested location at the end, etc) but all that happens is the css.php file doesn't get sent through the fastcgi process, and the raw PHP code is sent to the client. I've messed up somewhere, and I'm new to nginx (just migrated from Apache) so if someone could point out my error / give a quick explanation of how nested locations work, it would be ideal!

Thanks in advance!

Adrian
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Question about nested locations / PHP.

Tiberius March 09, 2012 05:14PM

Re: Question about nested locations / PHP.

Cliff Wells March 09, 2012 07:50PM

Re: Question about nested locations / PHP.

Tiberius March 09, 2012 08:42PM

Re: Question about nested locations / PHP.

Maxim Dounin March 10, 2012 04:18PM

Re: Question about nested locations / PHP.

Cliff Wells March 10, 2012 05:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
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