amazon web services - Unable to start Rails server on EC2 boot nginx+passenger. (Linux CentOs) -
i have set nginx+ passenger on ec2 box (amazon linux)
i need start rails server each time ec2 instance boots ( boot mean, stop
, start
)
i can start sever going app directory , doing passenger start -e p -p 80
but i'm not able start every time boots.
i tried put in /etc/rc.local
looks like:
cd /home/ec2-user/myapp rvmsudo passenger start -e p -p 80
but doesn't work. tried writing bash script , putting in /etc/init.d/
. did chmod +x
on it. still doesn't work. if run script manually bash start_script.sh
. works fine.
also if put mkdir tempfolder
works.
why isn't rails server not starting?
nginx.conf
server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /home/ec2-user/myapp/public; passenger_enabled on; } #error_page 404 /404.html; # redirect server error pages static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /home/ec2-user/myapp/public; } }
afaik when nginx
starts, takes care of passenger
takes care of rails
.
nginx
should start on machine startup. if doesn't try running
sudo update-rc.d nginx defaults
on more general note, not every bash
script works under init.d
. needs an init script lsb
i believe template create 1 (i've never tried though - on you...): https://gist.github.com/naholyr/4275302
Comments
Post a Comment