Report this

What is the reason for this report?

Rails app on Nginx too err to many redirects

Posted on November 11, 2021

I am trying to install an ruby on rails app using nginx, passenger and a digital ocean web server.

But when I try to open the webiste, i get a too many redirects error: i think the error is to be found in my nginx configuration file.

Could someone help me to solve it?

server {

  if ($host = partecipativa.online) {
    return 301 https://$host$request_uri;
  } # managed by Certbot

    listen 80;
   listen [::]:80 ipv6only=on;

  server_name partecipativa.online;
 return 404; # managed by Certbot


 }


server {

    server_name partecipativa.online;
    client_max_body_size 32M;

    passenger_enabled on;
    passenger_ruby /home/decidim/.rbenv/versions/2.7.1/bin/ruby;

    rails_env    production;
    root         /home/decidim/decidim-app/public;

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/partecipativa.online-0001/fullchain.pem; # manage>    ssl_certificate_key /etc/letsencrypt/live/partecipativa.online-0001/privkey.pem; # mana>    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot



}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.