I tried installing cartbot SSL certificate in my ubuntu server by following the instruction on this https://github.com/antonputra/tutorials/tree/main/lessons/078
The URL where I am trying to secure is https://perfect.riwajchalise.com.np/. When I checked the network tab it seems as if there is some kind of connection to the server but the request is not served
Here is my Nginx configuration
server {
root /var/www/html;
index index.html;
server_name perfect.riwajchalise.com.np;
location / {
try_files $uri $uri/ =404;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/perfect.riwajchalise.com.np/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/perfect.riwajchalise.com.np/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = perfect.riwajchalise.com.np) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name perfect.riwajchalise.com.np;
return 404; # managed by Certbot
}
I am using Cloudflare as DNS. I think that shouldn't be an issue.
You probably have a redirect loop because you configured cloudflare to connect over HTTP to your server.
Even when clients use HTTPS, Cloudflare does not and they get redirected:
And that creates an Infinite redirect loop.
Configure CloudFlare to connect over HTTPS to your server and the redirect loop will go away.
And rather than redirecting your site visitors to HTTPS from your server, set up a Cloudflare page rule instead.