Report this

What is the reason for this report?

Redirect IP to domain on nginx

Posted on March 1, 2021

Hello everyone. My recently installed Ghost site is working well, but after the install and domain propagation, I can still access through the public IP.

How can I prevent that from happening? I’ve tried some guides for redirecting the IP to my domain using the nginx config but nothing worked.

I’m currently using two server blocks at the end of default at /etc/nginx/sites-available

server {
server_name xxx.xxx.xxx.xx;
return 301 https://site.com;
}

server {
listen 443;
server_name https://site.com;
return 403;

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.