设为首页 加入收藏

TOP

[Linux]lnmp一键安装包,访问yii/tp5/laravel的时候,报错500或者空白页面(一)
2019-08-23 00:42:42 】 浏览:86
Tags:Linux lnmp 安装 访问 yii/tp5/laravel 时候 报错 500 或者 空白 页面

当你将默认的访问路径改后(nginx.conf中的root 之后的路径),同时应该将/home/wwwroot/default/.user.ini 中的路径也改了!

.user.ini 是隐藏文件,需要 ls -a  查看;

第一步:你先确定你的pathinfo路由开启了,配置如下:

lnmp v1.1上,修改对应虚拟主机的配置文件(/usr/local/nginx/conf/vhost/域名.conf)

去掉#include pathinfo.conf前面的#,把try_files $uri =404; 前面加上# 注释掉。

1.2,1.3上,修改对应虚拟主机的配置文件(/usr/local/nginx/conf/nginx.conf)
将include enable-php.conf;替换为include enable-php-pathinfo.conf;

修改pathinfo需要重启nginx生效。

第二步:路由重写设置成功

 1 server {
 2         listen       80;
 3         server_name  www.aaa.com;
 4         root   "你的项目路径";
 5         include  enable-php-pathinfo.conf;//开启pathinfo
 6       location /nginx_status
 7         {
 8             stub_status on;
 9             access_log   off;
10         }
11         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
12         {
13             expires      30d;
14         }
15        location ~ .*\.(js|css)?$
16         {
17             expires      12h;
18         }
19         location ~ /.well-known {
20             allow all;
21         }
22         location ~ /\.
23         {
24             deny all;
25         }
26         location ~ /index.php {
27             fastcgi_pass   127.0.0.1:9000;
28             fastcgi_index  index.php;
29             fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
30             include        fastcgi_params;
31             fastcgi_param APPLICATION_ENV dev;
32         }
33         location / {
34            index  index.html index.htm index.php l.php;
35            autoindex  on;
36            if (!-e $request_filename){
37               rewrite ^/(.*) /index.php last;
38            }
39         }
40         error_page   500 502 503 504  /50x.html;
41         location = /50x.html {
42             root   html;
43         }
44         location ~ \.php(.*)$  {
45             fastcgi_pass   127.0.0.1:9000;
46             fastcgi_index  index.php;
47             fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
48             fastcgi_param  SCRIPT_FILENA
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇读书笔记《PHP高级程序设计、模式.. 下一篇封装图片处理方法

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目