I'm trying to execute a PHP file on my server at the url /~nik/t.php
(actual file is at /home/nik/public_html/t.php
). Here's
what my PHP settings look like:
location ~ ^/~(.+?)(/.*)\.php$ {
alias /home/$1/public_html;
# What should this regex be?
fastcgi_split_path_info ^/~nik/(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
include fastcgi.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
I keep getting a 404, and when I comment out the clause around return 404;
, I'm able to see the error:
Unable to open primary script: /home/nik/public_html/~nik/t.php (No such file or directory)
Can you see what's wrong with my configuration, or point me to some docs on how to do this? It's unfortunate that an advanced knowledge of regexes is a requirement to configure nginx.