i have a location block for /
that passes any virtual paths to index.php
as instructed on the nginx pitfalls page. i have been using this setup for some time now, but recently i have noticed that some url's with -
in the path segment return 404 in nginx, meaning they never reach the php script. I'm not sure if its related to the -
in the url or not. some routes work with it, others do not.
works:
/profiles/recently-added
returns 404:
/explore/puerto-rico
/puerto-rico
server block:
server {
listen 80;
server_name example.com;
root /usr/share/nginx/hosts/www/;
location ~ \.(php)$ {
# commented out next 3 lines to see if that was the problem, but alas it made no change
# try_files $uri = 404;
# location ~ \..*/.*\.php$ {return 404;}
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_keep_conn on;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* .(png|gif|jpg|jpeg|ico|css|js)$ {
include /etc/nginx/mime.types;
expires 365d;
}
location / {
include /etc/nginx/mime.types;
index index.php;
try_files $request_uri $request_uri/ /index.php?$query_string;
}
}
I am struggling to understand what i've done wrong here. I've asked this question once before, and it was not well received. nginx version is from mainline branch, version 1.8.0