User might acccess the website using the server IP address instead of using website domain name. To avoid/bolck that we need to redirect.
- Insecure access of website using IP address can be blocked
- No need to add SSL certificate to IP address
Go to sudo vi /etc/nginx/sites-available/default
and add the following new server block of code to the configurationwith your domain name
server {
listen 80;
server_name 11.123.123.123;
return 301 $scheme://example.com$request_uri;
}