Nginx - redirected you too many times

Hi, I'm using Ubuntu 18.04 LTS and I setup LEMP stack using Webinoly. I uploaded an existing wordpress website and enabled SSL using site -ssl-on. But I'm getting the error " redirected you too many times." Here's my nginx configuration.

    server {
            listen 80;
            listen [::]:80;
            return 301 https://$host$request_uri;

    server {
            listen 443 ssl http2 default_server;
            listen [::]:443 ssl http2 default_server;


            # WebinolySSLstart
            ssl_certificate /etc/letsencrypt/live/;
            ssl_certificate_key /etc/letsencrypt/live/;
            ssl_stapling on;
            ssl_stapling_verify on;
            ssl_trusted_certificate /etc/letsencrypt/live/;
            # WebinolySSLend
            access_log /var/log/nginx/ we_log;
            error_log /var/log/nginx/;

            root /var/www/;

            index  index.php index.html index.htm;

            include common/php.conf;
            include common/wpcommon.conf;
            include common/locations.conf;
            include common/headers-http.conf;
            include common/headers-https.conf;
            include common/headers-html.conf;
            include /var/www/*-nginx.conf;

1 Reply

Hey @marccaps - based off of the redirect error message you're seeing, it sounds like you're caught in a redirect loop. That means that the site is being continuously redirected between addresses and can't complete. This Liquid Web article has a great explanation of how this can happen.

Via Stack Overflow, It looks like another user ran into a similar issue after enabling their SSL with Cloudflare. It looks like they were able to solve their issue with some changes to their Nginx configuration formatting:

HTTP to HTTPS Nginx too many redirects

Likewise, this other user was able to solve the issue with some different (but simple) configuration formatting changes:

Nginx configuration leads to endless redirect loop

If you haven't figured it out already, I hope these point you in the right direction! If you did fix the issue, I'd be curious to know which configuration changes you made to get things working.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct