By robywars
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
}
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!
Hi @robywars,
First I think the server block that listens to port 80 should be like that:
server {
listen 80;
listen [::]:80;
server_name mysite.com www.mysite.com;
return 301 https://www.mysite.com$request_uri;
}
Of course where you see mysite.com change it to your actual domain.
If that doesn’t help, then I would recommend checking your Ruby application for some possible redirects. What I see when I curl your domain is, I reach the domain with HTTP, get redirected to HTTPS and then I’m constantly being redirected to:
Location: https://partecipativa.online/system/
Location: https://partecipativa.online/system/admins/sign_in
Location: https://partecipativa.online/system/
and so on, which leads me to believe it’s highly possible it’s the Ruby App that is causing the issues.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.