php7 laravel nginx配置
1、可能会导致访问php变下载
2、配置后不能访问
3、版本PHP7
配置如下:
server {
listen 81;
server_name localhost;
ssl off;
root /xxxx/api/public;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php?.*$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.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;
include fastcgi.conf;
}
if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$1 permanent;
}
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
}
- 先保证9000端口正常
- 路径一定要配置到public下