# Remove trailing slash to please routing system.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
after / location block
Sub directory install config
# version 1
location ^~ /demo1 {
alias /home/tom/public_html/demos/demo1/public;
try_files $uri $uri/ @demo1;
location ~* \.php {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
}
}
location @demo1 {
rewrite ^/demo1/(.*)$ /demo1/index.php/$1 last; # THIS IS THE IMPORTANT LINE
}
# end version 1
# version 2
# this is with `ln -s /home/tom/public_html/demos/demo1/public <document root>/demo1`
location ~ /demo1 {
try_files /demo1/$uri /demo1/$uri/ /demo1/index.php?q=$uri&$args;
}
# end version 2
Add this
after
/
location blockSub directory install config
Ref: https://gist.github.com/tsolar/8d45ed05bcff8eb75404