Force Nginx to log error?

Carl Winbäck c at tunnel53.net
Sat Jun 20 08:06:39 UTC 2020


On Sun, 14 Jun 2020 at 17:34, Carl Winbäck <c at tunnel53.net> wrote:
> It would be useful to me to be able to trigger such messages, so that
> I can verify that they are sent to the right destination.

I found a simple way to trigger a message to the error log, so I
thought I’d share it in case someone also has use for this.

If the root of your site is /foo/mysite/ create an empty directory
there, e.g. /foo/mysite/xyzzy

Do *not* create any index file there, e.g. no index.html or index.php

Now you request that URL via any client of your choice, e.g. curl:

curl https://mysite.example.com/xyzzy/

That request will trigger a message to the error log that looks like
this:

2020/06/20 07:30:04 [error] 694#694: *835 directory index of
  "/foo/mysite/xyzzy/" is forbidden, client: 172.16.3.248, server: ,
  request: "GET / HTTP/1.0"


Best regards,
Carl


More information about the nginx mailing list