【问题标题】:Get error when running a laravel app in ubuntu在 ubuntu 中运行 laravel 应用程序时出错
【发布时间】:2018-08-08 07:47:02
【问题描述】:

我在 ubuntu 中使用过 nginxphp-fpm,并且我编辑了如下文件: /etc/nginx/sites-available/default

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name _;
        root /usr/test/public/;

        index index.php index.html index.htm;

        location / {
             try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
            try_files $uri /index.php =404;
            fastcgi_pass 127.0.0.1:9999;
            fastcgi_index index.php;
            fastcgi_buffers 16 16k;
            fastcgi_buffer_size 32k;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            #fixes timeouts
            fastcgi_read_timeout 600;
            include fastcgi_params;
        }
}

/etc/php/7.1/fpm/pool.d/www.conf

listen = 127.0.0.1:9999

我还更改了以下权限:

chown -R www-data:www-data /usr/test/public
chmod 755 /usr/test
chmod -R 755 /usr/test/bootstrap/cache
chmod -R 755 /usr/test/AppName/storage

但是当我尝试运行一个简单的 laravel 项目时,它向我显示了以下错误消息:

The stream or file "/usr/test/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

这是为什么呢?

【问题讨论】:

  • stackoverflow.com/questions/30639174/…你可以参考这里权限的事情
  • chmod -R 755 /usr/test/storage
  • @SanK 好的,让我看看
  • @kerbholz 我试过了,但仍然遇到同样的错误。
  • @kerbholz 怎么样,它有效!我试过 chown -R www-data:www-data /usr/test ,谢谢!

标签: php ubuntu nginx


【解决方案1】:

也试试chmod -R 777 您是否为您的应用程序生成了应用程序密钥?如果没有,请按照以下步骤操作 在您的终端类型上:php artisan key:generate 然后将其添加到您的 .env 文件中 APP_KEY=YOUR_GENERATED_KEY

它可能被隐藏了,在你的项目文件夹中按 ctrl + h 来查看它。

【讨论】:

    猜你喜欢
    • 2016-10-07
    • 2015-10-21
    • 2016-04-05
    • 1970-01-01
    • 1970-01-01
    • 2018-02-26
    • 1970-01-01
    • 2018-10-03
    • 2011-05-25
    相关资源
    最近更新 更多