简体   繁体   English

在ubuntu中运行laravel应用时出错

[英]Get error when running a laravel app in ubuntu

I was used nginx and php-fpm in ubuntu, and I had edited the files like following: /etc/nginx/sites-available/default 我在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 /etc/php/7.1/fpm/pool.d/www.conf

listen = 127.0.0.1:9999

And I also changed the permissions like following: 而且我还更改了权限,如下所示:

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

But when I tried to run a simple laravel project, it shows me this error message: 但是,当我尝试运行一个简单的laravel项目时,它显示了以下错误消息:

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

Why is that? 这是为什么?

try chmod -R 777 also did u generate app key for your application? 尝试chmod -R 777还为您的应用程序生成了应用程序密钥? if not please follow below steps on your terminal type: php artisan key:generate then add it to your .env file APP_KEY=YOUR_GENERATED_KEY 如果不是,请在您的终端类型上执行以下步骤: php artisan key:generate然后将其添加到您的.env文件APP_KEY = YOUR_GENERATED_KEY

it may be hidden, do ctrl + h in your project folder to view it. 它可能是隐藏的,请在项目文件夹中按ctrl + h进行查看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM