IP not redirecting to HTTPs configured Domain with SSL

Hi All,

I’ve been secured my Nginx server with Origin Certificates, I can reach my domain with HTTPs, but when I reach my website with IP address it saying not secured, I assume the IP must redirect automatically to DNS!! I have another server with the same configuration, and it is woking!!

Any idea, what’s going wrong!!

IP addresses rarely have a corresponding SSL certificate, as those use hostnames.

Hey,

Thank you for the quick reply. I do have another server with the same configuration and Origin Certificates. When I reach my website via IP address it will redirect to the domain name with HTTPs.

I checked file config /etc/nginx/sites-available/ … , it’s exactly the same, Also the settings from cloud flare dashboard, I am 100% sure I adjusted all settings correctly.

Question! why when I reach my website via IP it doesn’t redirect to the domain name?

FYI : server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;

    ssl_certificate         /etc/ssl/cert.pem;
    ssl_certificate_key     /etc/ssl/key.pem;
    ssl_client_certificate /etc/ssl/cloudflare.crt;
    ssl_verify_client on;

    server_name yyy.com www.yyy.com;
    root /var/www/yyy.com/html;
    index index.html index.htm index.nginx-debian.html;


    location / {
            try_files $uri $uri/ =404;
    }

}

This topic was automatically closed after 30 days. New replies are no longer allowed.