Laravel.log文件未更新日志

时间:2018-06-23 07:50:23

标签: laravel laravel-5.6

我安装了laravel 5.6并将所有内容粘贴到服务器Digital Ocean上。现在Laravel.Log文件未更新任何内容。我应该采取任何步骤来解决这个问题吗?

.env文件:

    APP_NAME=Laravel
    APP_ENV=local
    APP_KEY=base64:S2IOFJ8ruj9fUV5qhOWs7+A48DrIM1bIA9yZ83HbRfQ=
    APP_DEBUG=true
    APP_LOG_LEVEL=debug
    APP_URL=http://localhost

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=mysql
    DB_USERNAME=root
    DB_PASSWORD=*****

    BROADCAST_DRIVER=log
    CACHE_DRIVER=file
    SESSION_DRIVER=file
    QUEUE_DRIVER=sync

    REDIS_HOST=127.0.0.1
    REDIS_PASSWORD=null
    REDIS_PORT=6379

    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.mailtrap.io
    MAIL_PORT=2525
    MAIL_USERNAME=null
    MAIL_PASSWORD=null
    MAIL_ENCRYPTION=null

    PUSHER_APP_ID=
    PUSHER_APP_KEY=
    PUSHER_APP_SECRET=

1 个答案:

答案 0 :(得分:0)

您可以在主控制器中使用自定义日志。或返回一个普通的字符串而不是视图。

Log::info("test");
return "test";

如果什么都没有改变,那就还有另一个问题。

  1. Web服务器
  2. PHP fpm
  3. 任何操作系统问题

正确配置Laravel项目:

Apache

<VirtualHost **IP**:80>
    ServerName yourtradelog.com
    ServerAlias www.yourtradelog.com
    ServerAdmin info@yourtradelog.com
    DocumentRoot /home/user/public_html/yourtradelog/public
    UseCanonicalName Off
    ScriptAlias /cgi-bin/ /home/user/public_html/cgi-bin/

    <IfModule mod_userdir.c>
        UserDir disabled
        UserDir enabled user
    </IfModule>

    <IfModule mod_suexec.c>
        SuexecUserGroup user user
    </IfModule>

    <IfModule mod_suphp.c>
        suPHP_UserGroup user user
        suPHP_ConfigPath /home/user
    </IfModule>

    <Directory "/home/user/public_html">
        AllowOverride All
    </Directory>
</VirtualHost>

Nginx

server {
    listen 80;

    server_name yourtradelog.com;
    root "/home/user/public_html/yourtradelog/public";
    index index.php index.html index.htm;
    charset utf-8;
    access_log off;
    error_log /var/log/nginx/laravel.log error;
    sendfile off;
    client_max_body_size 100m;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico {
        access_log off;
        log_not_found off;
    }

    location /robots.txt {
        access_log off;
        log_not_found off;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffers 4 16k;
        fastcgi_buffer_size 16k;
        fastcgi_connect_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }
}