ubuntu
server
{
listen 5008 default_server;
server_name 192.168.0.148;
index index.php index.html index.htm default.php default.htm default.html;
root /home;
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
try_files $uri $uri/ /index.php$is_args$args;
}
access_log /var/log/access.log;
error_log /var/log/error.log;
}
centos
server {
listen 5008;
server_name 127.0.0.1;
root /home;
location / {
index index.php index.html index.htm;
#try_files $uri $uri/ /index.php?$args;
autoindex off;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}