猿问

laravel上线之后nginx报500,什么问题?

上线了项目之后,报这个错;

已经配置了storage和bootstrap文件夹的权限;

https://img4.mukewang.com/5c8f538b0001d9b108000060.jpg

这个是.env的配置文件,应该也没有什么问题;

https://img2.mukewang.com/5c8f538d0001ce2304460451.jpg

这个是nginx的二级域名的配置文件,截图截不全,就直接贴代码了;


server
    {
        listen 80;
        #listen [::]:80 default_server ipv6only=on;
        server_name laravel.killlol.com;
        index index.html index.htm index.php;
        root  /home/wwwroot/default/laravel/public;

        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        #  include enable-php.conf;

        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }
        
        location /'
        {
          try_files $uri $uri/ /index.php?$query_string;
        }

    try_files $uri $uri/ @rewrite; 
  
        location @rewrite { 
          rewrite ^/(.*)$ /index.php?_url=/$1; 
        } 
        access_log  /home/wwwlogs/access.log;
    }

这个是我namesilo上的解析地址;

https://img3.mukewang.com/5c8f538e000187b308000036.jpg

我觉得是Nginx的解析有问题,因为跑了几次,Nginx的日志文件都没有相应的记录,是这个问题吗?求助;

ps:

nginx的配置文件如下;

https://img4.mukewang.com/5c8f538f000169dc04530105.jpg

把.env里的APP_URL的内容删掉了,但是还是不行;

https://img1.mukewang.com/5c8f53900001c5e304680100.jpg

最新进展

应该是Nginx配置的问题,但是我这个Nginx配置,之前在阿里云也上线过几个Laravel的项目,现在在用vultr的VPS,但是这个为什么不行了呢?求助;

server
    {
        listen 80;
        #listen [::]:80 default_server ipv6only=on;
        server_name zhihu.jeffcottlu.com;
        index index.html index.htm index.php;
        root  /home/wwwroot/default/laravel_zhihu/public;

        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        #  include enable-php.conf;

        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }
        
        location /
        {
          try_files $uri $uri/ /index.php?$query_string;
        }

    try_files $uri $uri/ @rewrite; 
  
        location @rewrite { 
          rewrite ^/(.*)$ /index.php?_url=/$1; 
        } 
        access_log  /home/wwwlogs/access.log;
    }

慕容3067478
浏览 1449回答 6
6回答

有只小跳蛙

刚好我今天也遇到这个问题,我一般都会从这几个方面查找1.文件需要读写权限2.nginx配置错误3.php版本不对应你可以去php.ini把display_errors = OFF修改成On 会打印出错误信息

沧海一幻觉

还有一种个能是需要关闭selinux (centos)

梵蒂冈之花

500就是你代码有错 要么就php版本不兼容 和nginx没关系
随时随地看视频慕课网APP
我要回答