I'm using Amazon EC2 and tried to deploy a rails project. I have install nginx/passenger and successfully made nginx server run.
I started my rails project with name "forfun" then I set the root of nginx to /home/ubuntu/rails/forfun/public
I initialized a file named "index.html", then I could see the page in browser ( http://[my ip]:80)
However, what i really wanna see is the welcome page of rails app.
I tried do remove index.html and see what i got. I saw 404 Forbidden error. /var/log/nginx/error.log reveals that directory index of "/home/ubuntu/rails/forfun/public/" is forbidden
What step i actually missed?
by the way, do i need to do "rails server" while nginx is running?
ps: (1) /opt/nginx/conf/nginx.conf
http { passenger_root /usr/local/rvm/gems/ruby-2.3.0/gems/passenger-5.0.26; passenger_ruby /usr/local/rvm/gems/ruby-2.3.0/wrappers/ruby; ... server { listen 80; server_name 52.196.XX.XXX;#my amazon public ip root /home/ubuntu/rails/forfuni/public; }
(2)/etc/nginx/sites-enabled/default
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /home/ubuntu/rails/forfun/public; index index.html index.htm; }
Try adding /etc/nginx/sites-enabled/default
server {
listen 80 default_server;
server_name 52.196.XX.XXX;#my amazon public ip;
passenger_enabled on;
passenger_app_env development; #or whatever rails env you want.
The whole process of deploying a rails app using nginx/passenger is documented here . See the nginx section.
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.