nginx configuration filenginx.conf
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
All subsite configuration files are not configured with access_log off
The following is a subsite configuration filevhost/app3.abc.com.conf
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
There are many subsite configuration files, but access_log off is not configured
After passing the above configuration, every time the nginx/logs/access.log
log file is deleted, a new access.log log file will be generated the next day, with a size of about 1G. The company's requirement is to turn off nginx's access.log function, which means not allowing nginx to record access logs. Does anyone have a better solution? Thank you so much!
phpcn_u15822017-05-16 17:18:07
The answer has been found.
Actually, it’s said on the Internet access_log /dev/null;
只是针对nginx的error_log而言的。如果想关闭error_log
,那么就用error_log /dev/null
(see what foreigners do).
But want to closeaccess_log
的话,直接在nginx.conf
的http模块中配置access_log off;
即可。需要注意的是,已经继承了http模块的那些模块不要再设置access_log off;
了。 比如,我已经在http模块中设置了access_log off;
,那么就不要在http模块所包含的server模块或location模块中设置access_log off;
,以及虚拟主机目录(vhost)下的配置文件也不要添加access_log off;
.
Pure practical experience in production environment.