cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring Magento for SSL-only with NGINX

Configuring Magento for SSL-only with NGINX

We have a Magento 1.9x installation and have it configured to be 100% SSL (both the secure and insecure web settings are set with https). However, when trying to get it to use NGINX we get an infinite redirect loop. I know the redirect loop is a reported a lot, but none of the solutions I've found seem to speak directly to this issue.

 

Simply adding this to the server block doesn't seem to work:

 

listen xxx.xxx.xxx.xxx:443 ssl;
listen [::]:443 ipv6only=on ssl;
ssl on;
ssl_certificate /home/relevant_path/bundle.crt;
ssl_certificate_key /home/relevant_path/bundle.key;

 

I've also tried the NGINX configuration offered by Magento and I get the same error.

2 REPLIES 2

Re: Configuring Magento for SSL-only with NGINX

maybe you have something else configured, where it redirects in loop? to http?

 

this is all you need:

server {
    listen 80;
    server_name *.example.com;
    return 301 https://www.example.com$request_uri;
}

server {   
    listen 443 http2 ssl;
    server_name www.example.com;

....
------------
MagenX - Magento and Server optimization

Re: Configuring Magento for SSL-only with NGINX

I did as you suggested but I still get an error in the browser that there are too many redirects. As far as I know, the only redirects are controlled via the core_url_redirect table so I'm stumped.

 

It is correct to have "https" in Configuration > Web > Secure and Configuration > Web > Insecure, correct?