Nginx how to remove www from url?

December 26, 2013 5.9k views
Hello - Having a bit of trouble setting up a permanent redirect from "" to "". After following this article I'm now getting this error "Firefox has detected that the server is redirecting the request for this address in a way that will never complete." Here's the NGINX config file I edited in /etc/nginx/sites-available/default My droplet is Ruby on Rails on Ubuntu 12.10 (Nginx + Unicorn). Any help would be much appreciated thanks.
3 Answers
Hello there,
in your second server block you need to specify a server_name:
Thanks Santiago, now the redirect is working but I'm getting an error I never had before "no implicit conversion of nil into String". You can see it at Any thoughts?

I tried reinstalling pristine versions of my gem. Also tried adding:
ActionController::Base.config.relative_url_root = ''

to application.rb. Adding config.relative_url_root = "" to my Song controller also didn't work
That's an error with your app, it's not related to nginx.
        {'title':'', 'url':''},

Either songscm.title or songscm.youtube_url (or both) is null apparently.
Have another answer? Share your knowledge.