Configure Nginx for HTTPS - cannot establish secure connection!

September 20, 2016 4k views
Nginx Ubuntu 16.04

So I got the website up and running, got HTTPS working and configured Nginx to redirect http calls over to HTTPS

sudo nano /etc/nginx/sites-enabled/default

# HTTP - redirect all requests to HTTPS:
server {
        listen 80;
        listen [::]:80 default_server ipv6only=on;
        return 301 https://$host$request_uri;

All seems to be working great! So goes out and have a coffee at a fast food restaurant in the city. They have wifi available so decide to check out the new website.
Problem is it comes back with an error - “cannot establish an secure connection” - I am assuming their free wifi is configured not to allow HTTPS calls.

I hate to think the website may be unavailable (think of all the new users I am going to lose!). I could disable the nginx redirect to https - but my problem is the app uses needs access to the microphone and without HTTPS you get horrible request boxes.

So my question is there anyway to configure the HTTPS redirect so that if it fails to will go to normal http?

  • Can you share your site URL? it’s hard to say anything without more information about the error message.

  • The URL is - I have not yet had chance to try the suggestion regrading ipv6only yet.

1 Answer

I think you need to remove the “ipv6only=on” part.

Have another answer? Share your knowledge.