美文网首页
如何在 nginx 上禁掉 access_log 和 error

如何在 nginx 上禁掉 access_log 和 error

作者: vixuowis | 来源:发表于2016-12-26 13:16 被阅读556次

    参考这篇 blog https://www.digitalocean.com/community/tutorials/how-to-configure-logging-and-log-rotation-in-nginx-on-an-ubuntu-vps

    如果不想要积累太多 nginx log,直接点禁掉 log,或者 rotate log 见上文。

    全局禁掉 error_log 很简单:
    error_log /dev/null crit;

    禁掉 access_log 不能在全局做,会提示:
    nginx: [emerg] "access_log" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:7

    所以需要在 server 下搞:
    access_log off;

    相关文章

      网友评论

          本文标题:如何在 nginx 上禁掉 access_log 和 error

          本文链接:https://www.haomeiwen.com/subject/vvejvttx.html