doutuo7609 2016-02-21 00:10
浏览 454
已采纳

php-fpm写巨大的日志文件

in /usr/local/nginx/logs/ I have a huge www.access.log file.

It grows undefinitely (last time I truncated it was 3.5 GB) with a new log entry every time a php script is called.

Every line looks like this:

- -  21/Feb/2016:00:59:09 +0100 "GET /index.php" 200 /absoulute-path/index.php 10,373 1280 96,40%

The file is written by php-fpm process

Browsing thru the various configuration files (nginx, php.ini....) I cannot find the directive to write logs to that file.

How can I disable it?

  • 写回答

3条回答 默认 最新

  • dqz7636 2016-02-21 02:02
    关注

    Given the format and the informations provided in the sample log entry posted in the question the huge log file has nothing (directly) to do with nginx nor with its configuration files, despite it's located in .../nginx/logs/

    That ....access.log file is written by php-fpm worker processes when a specific option is set into php-fpm's configuration file php-fpm.conf

    The file (on my server) is located into /etc/

    At some point in the configuration file there is:

    ; The access log file
    ; Default: not set
    ; access.log = /usr/local/nginx/logs/$pool.access.log
    

    By default that option is not set and should remain unset; as far as I know the log file it produces is used to test php-fpm proper operation.

    If the line is uncommented by removing the semicolon...

    ; The access log file
    ; Default: not set
    access.log = /usr/local/nginx/logs/$pool.access.log
    

    ...then a .access.log file prefixed with the pool name (www in the case exposed in the question) is generated. And it grows quickly as each time a php script is run due to a request a new log entry is appended.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架