which of the two files is for ssl and how does it work with cloudflare

I created a droplet2 to host from a snapshot image copied from another droplet1 that hosted has wordpress and it works fine, but when I visited , it says too many re-direct.

I have modified droplet2 in this way:

  1. in the /etc/nginx/sites-enabled/default I have replaced domain1 with domain2.

  2. in the /etc/nginx/sites-enabled/default I see this line:

sslcertificate /etc/nginx/ssl/domain2/cert.pem; 
sslcertificatekey /etc/nginx/ssl/domain2/key.pem; 

I have a couple of questions:

2a I see two location for the ssl

location1: the first is this /etc/nginx/ssl/domain2/cert.pem in file /etc/nginx/sites-enabled/default

location2: the second is this one in /etc/nginx/snippets/snakeoil.conf:

 sslcertificate /etc/ssl/certs/ssl-cert-snakeoil.pem; 
 sslcertificatekey /etc/ssl/private/ssl-cert-snakeoil.key;

my question is which location (location1 or location2) can I find my ssl file?

2b I copied the “Origin Certificates” from cloudflare to both /etc/nginx/ssl/domain2/ and /etc/ssl/ but I still have the “too many redirect messages”

3 I noticed that my cloudflare, under Crypto it is “flexible” ssl. When I changed from “flexible” to “full” it seems working, regardless if I used the ssl files downloaded from cloudflare or not. Even if the “Origin Certificates” from cloudflare do not match the files in location1 or locatin2, it is still working with “full” ssl. How is this possible?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


The .pem file should be the one you need as it contains all of the necessary SSL files: the private key, the certificate and the CA bundle.

Have you tried checking if the SSL certificate is installed correctly with the website for example or with the openssl command?

Maybe the problem is not with the certificate but with your application itself, for example if you are using Wordpress you need to make sure that your Site and Home URLs are updated correctly, or if you are using Laravel you have to update your APP URL in your env file.

If this was a SSL problem, then you would, in most cases, just get a SSL warning.

Hope that this helps! Bobby