开发者

Stop NGINX from logging my IP address

I'd like to stop NGINX from logging my own IP addreess in my access.log Is this possible? I can ea开发者_运维技巧sily do it in Apache but I haven't been able to find anything like this for NGINX.


This should really be on serverfault so I'll vote for a move.

But I can help a little here.

Short version, no you can't.

Long version. You can hack around it by using different backends for where you log one and don't log the other. Or by creating an extra server on a different port. But there isn't really a clean way of filtering an IP address from the logs.

You can however filter by url, perhaps that is an option for you?


You could create a virtual host that will log only your accesses, while the main log will log the rest. In this case you would access the new virtual host from your machine.

server {
  listen       80;
  server_name  domain.com www.domain.com;
  access_log   logs/domain.access.log;

Then you create a second one

server {
  listen       80;
  server_name  me.domain.com;
  access_log   logs/me.domain.access.log; 

Or remove the last line.
This way your accesses won't mix with the external accesses.

You have to add me.domain.com in DNS or in your /etc/hosts, with the same IP as the main domain.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜