Nginx

The tips & tricks about Nginx server.

Restricting Access with HTTP Basic Authentication in Nginx

Restricting Access with HTTP Basic Authentication in Nginx

Restricting access to your website or some parts of it by implementing a username/password authentication. Prerequisites Nginx Password file creation utility such as apache2-utils (Debian, Ubuntu) or httpd-tools (RHEL/CentOS/Oracle Linux). Creating a Password File 1. The first time we use this utility, we need to add the -c option to create the specified file....
Continue reading
Nginx warning: using uninitialized "x" variable while logging request

Nginx warning: using uninitialized "x" variable while logging request

Recently, when checking nginx's log, I found a very strange log, so I tried my best to check it. This is nginx's error_log: 2022/01/08 11:20:42 [warn] 17711#17711: *7482384 using uninitialized "server" variable while logging request, client: 45.135.xxx.xx6, server: 127.0.0.1, request: "GET /node_modules/../../../../../etc/passwd HTTP/1.1" This same as the server is under...
Continue reading