Laravel在Nginx上提供空白页面

时间:2014-08-26 19:32:24

标签: php nginx

所以,过去两天我一直在试图安装Laravel。我是这个框架的新手,但想学习它。我在Nginx服务器上使用composer安装它。之后我改变了Nginx配置文件。现在,我得到的只是一个空白页面而已。我还更改了app/storage的权限。

您可以在下面找到我的配置文件:

server {
    server_name website.com www.website.com;
    root /var/www/website.com/htdocs/public/;

    index index.php index.html;

    #browse folders if no index file
     autoindex on; 

    # serve static files directly
    location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
        access_log off;
        expires max;
    }

    # removes trailing slashes (prevents SEO duplicate content issues)
    if (!-d $request_filename)
    {
        rewrite ^/(.+)/$ /$1 permanent;
    }

    # enforce NO www
    if ($host ~* ^www\.(.*))
    {
        set $host_without_www $1;
        rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
    }


    # canonicalize codeigniter url end points
    # if your default controller is something other than "welcome" you should change the following
    if ($request_uri ~* ^(/lobby(/index)?|/index(.php)?)/?$)
    {
        rewrite ^(.*)$ / permanent;
    }

    # removes trailing "index" from all controllers
    if ($request_uri ~* index/?$)
    {
        rewrite ^/(.*)/index/?$ /$1 permanent;
    }

    # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
    if (!-e $request_filename)
    {
        rewrite ^/(.*)$ /index.php?/$1 last;
        break;
    }

    # catch all
    error_page 404 /index.php;

   location ~ \.php$ {
    try_files $uri $uri/ /index.php?$args;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        #include fastcgi_params;
        include /etc/nginx/fastcgi_params;
    }
}

1 个答案:

答案 0 :(得分:-1)

  1. 检查www-data用户

    的权限
    sudo chown -R :www-data /your/location
    
  2. 检查文档根路径

  3. 再次检查此部分:location ~ \.php$ ...

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    
  4. 检查错误日志

  5. 取消注释&在;cgi.fix_pathinfo=1

  6. 中将cgi.fix_pathinfo=0修改为php.ini
  7. 使用Homestead&锻造