erbmicha

the random braindump of a supergeek

erbmicha header image 2

Phusion Passenger + nginx + SSL

April 21st, 2009 · 4 Comments · Rails, Tutorial

How to get Passenger to install nginx with SSL support:

1. change to the /tmp directory
cd /tmp
2. download the nginx source
wget http://sysoev.ru/nginx/nginx-0.6.36.tar.gz
3. unpack it
tar zxf nginx-0.6.36.tar.gz
4. install the passenger gem
sudo gem install passenger
5. run the passenger nginx module install
passenger-install-nginx-module
6. When asked: ‘Do you want this installer to download, compile and install Nginx for you?’, answer
2
7. When asked: ‘Where is your Nginx source code located?’, answer
/tmp/nginx-0.6.36
8. When asked: ‘Where do you want to install Nginx to?’, answer
/opt/nginx
9. When asked about: ‘Extra arguments to pass to configure script:’, answer
--with-http_ssl_module
10. When asked to ‘Confirm configure flags’, answer
yes

That’s it. Good luck!

Tags: ···

4 Comments so far ↓

  • Jimmy Baker

    Do you have a working config for SSL using Passenger + nginx? I added the proxy_set_header directives too (including proxy_set_header X-FORWARDED_PROTO https;) and I’m still not getting any love. I get “Redirect Loop” in Firefox. If you have a working config, would you mind sharing?

    • erb

      Jimmy, I’m at Railsconf and spoke with the Phusion guys regarding this. Ninh hadn’t seen the problem but wasn’t surprised due to the amount of reverse-engineering that they had to do for the nginx passenger module. I’ll post any updates I get from them.

    • erb

      it’s all good now! turns out there was a bug in Passenger 2.2.1 – update to Passenger 2.2.2 and everything works great!

  • Nalin Mittal

    I get 403 errors for any server config with a location block that includes:

    proxy_set_header X-FORWARDED_PROTO https;

    I am using Passenger 2.2.2 with Nginx. If I remove the location block, nginx serves the app fine on the port specified, but if I do include the block, it’s a 403 error.

    If anyone can help with this, I would really appreciate it!

Leave a Comment