参考链接

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
location / {
try_files $uri $uri/ @extensionless-php;
}

location ~ \.php$ {
if ($request_uri ~ (.*)\.php$) {
return 301 $1;
}

include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}