简体   繁体   中英

Phusion Passenger + NGinx with Rails 3

indexI am trying to deploy a simple Rails 3 app on a AWS EC2 with a Ubuntu 12.04 64 bit AMI. I followed the steps in the Phusion Passenger NGinx install page. I also used RVM which was installed successfully.

My steps:

  1. Install and configure RVM
  2. Install Ruby 1.9.3
  3. Install Rails 3.2.3
  4. Install Passenger
  5. Run passenger-install-nginx-module (had to use rvmsudo)
  6. Created a new rails app (rails new passenger_test)
  7. Added the following config section to the nginx.conf

     server { listen 80; server_name localhost; root /home/ubuntu/passenger_test/public; passenger_enabled on } 

I restarted nginx and the rails default public/index.html default rails page shows up but the rails.png doesn't render and "view your application's enviroment" link does not work. I have tried four different times on four fresh new server and always get the same result. Please help!

Ok. Just tried Ubuntu 11.10 t1.micro and got same error. Also tried Ubuntu 11.10 on a m1.small which was somewhat successful. This time got a 404 on the rails.png which what I think is normal in the production environment. Tried changing my rack/rails environment in my nginx.conf file as described here: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_rack_app but got 500 server errors. Tried many other combination with changing the environment but still 500. Found out that if you set bot the rack_env and rails_env config option it complains about duplicate rails_env node. So went back to production and will try with a real rails app tomorrow.

ps The only other step I did differently on the m1.small is that I installed only rails after I ran passenger-install-nginx-module. Once NGinx and Passenger where installed and before I installed Rails I tested a simple Rack app as described here: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_rack_app and it worked!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM