I've just done an install of moodle and it's using urls like this for its theme:
http://moodle.example.com/theme/styles.php/standard/1380191797/all
nginx isn't picking up that that's a call to a PHP file and baulks with a 404.
My current rewriting technique revolves around picking up references to /index.php
which may seem antiquated but it has worked on a lot of fiddly things before. Here's my current config.
server {
listen 80;
server_name moodle.example.com;
root /websites/sbmoodle/moodle;
index index.php;
location / {
try_files $uri $uri/ /index.php$request_uri /index.php;
}
location ~ \.php($|/) {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name$fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
Now I look under the cold light of Stack Exchange, at it I feel like the php handler at the end (\.php($|/)
) should be catching these. But nginx is still chucking out 404s. Why?
And yes, I have tested /theme/styles.php
(without a following path) and it works fine.