To deny access for a specific IP address on HTTPS port 443 using Nginx, follow these steps:
Open your server block configuration file. This file is usually located in the /etc/nginx/sites-available/ directory.
Add the following code inside the server block to create a new location block for HTTPS port 443:
location / {
# Your other configuration goes here
}
location / {
# Your other configuration goes here
if ($remote_addr = 10.10.10.10) {
return 403;
}
}
Replace “10.10.10.10” with the IP address you want to deny access to.
sudo service nginx reload
The above configuration will block access to the HTTPS port 443 for the specified IP address. When the IP address tries to access the server, they will receive a “403 Forbidden” error.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-01-15 11:00:00 +0000
Seen: 10 times
Last updated: May 10 '22