我试过http://www.thinkphp.cn/topic/...,实际访问报404
nginx 1.10.3
php-fpm
php7.1
Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-117-generic x86_64)
这是环境,
下面是我apache中关于php-fpm的相关配置
index index.html index.htm index.php default.html default.php index.nginx-debian.html;
# if (!-e $request_filename)
# {
# #地址作为将参数rewrite到index.php上。
# rewrite ^/(.*)$ /index.php/$1;
# #若是子目录则使用下面这句,将subdir改成目录名称即可。
# #rewrite ^/subdir/(.*)$ /subdir/index.php/$1;
# }
# location ~ .php
# {
# #原有代码
#
# #定义变量 $path_info ,用于存放pathinfo信息
# set $path_info "";
# #定义变量 $real_script_name,用于存放真实地址
# set $real_script_name $fastcgi_script_name;
# #如果地址与引号内的正则表达式匹配
# if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
# #将文件地址赋值给变量 $real_script_name
# set $real_script_name $1;
# #将文件地址后的参数赋值给变量 $path_info
# set $path_info $2;
# }
# #配置fastcgi的一些参数
# fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
# fastcgi_param SCRIPT_NAME $real_script_name;
# fastcgi_param PATH_INFO $path_info;
# }
location / {
# if (!-e $request_filename) {
# rewrite ^/(.*)$ /index.php/$1 last;
# break;
# }
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ~ ^(.+\.php)(.*)$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}