Nginx settings log does not record 404 or 200 or other log information

Source: Internet
Author: User

Here we use ngx_log_if, which is a third-party module of Nginx.


The first step:

First go to GitHub to download the ngx_log_if address https://github.com/cfsego/ngx_log_if/, you can download the compressed package and then unzip the unzip Ngx_log_if-master.zip

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/83/CE/wKiom1d8weawHpXQAABfqDAXHvY408.png-wh_500x0-wm_3 -wmp_4-s_3342465571.png "title=" Nginxlog.png "alt=" Wkiom1d8weawhpxqaabfqdaxhvy408.png-wh_50 "/>


Step Two

Compile and install Nginx./configure--prefix=/usr/local/nginx--with-pcre--add-module=/root/ngx_log_if-master # #记得带上这个模块


Make && make install


After the installation is complete, use/USR/LOCAL/NGINX/SBIN/NGINX-V to see which modules you have installed


Step Three: note (if your host profile in vhhosts this directory, may not work, and finally configured in nginx.conf this main configuration file)

Configuring ACCESS_LOG_BYPASS_IF to the nginx.conf configuration file

server {
Location/{
access_log_bypass_if ($status = 404); #不记录404状态的所有日志信息
Access_log_bypass_if ($uri ~* ' images '); #不记录uri中所有images目录下文件的日志信息
Access_log_bypass_if ($uri = '/index.html '); #不记录uri为 Log information for/index.html
Access_log_bypass_if ($host ~* ' tonv.cc '); All log information for #不记录host为tonv. CC
}

}

Finally, the Nginx service will be restarted.


This article is from the "Drifting Away" blog, make sure to keep this source http://825536458.blog.51cto.com/4417836/1811273

Nginx settings log does not record 404 or 200 or other log information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.