Deploying rails application
I am trying to deploy a rail application which is in /opt/rails/my_app. To achieve this I have installed passenger gem and configured nginx using passenger-install-nginx-module. I can access the static welcome page, however when I try some other page like home (which is generated by rails generate controller home index), the br开发者_Go百科owser keep waiting and waiting for response.
This does not happen when I deploy the application using rails s
on port 3000.
UPDATE
When I execute passenger-install-apache2-module
, I get g++: unrecognized option '-R/usr/local/lib'. I figured that I need to change '-R/usr/local/lib' to 'Wl,-R/usr/local/lib' in order to compile the LoggingAgent properly. Can you please tell me how to change the make file?
Regarding NGINX, it's sounding as though it's a permissions issue on some of your files and/or directories. I would instead move the app to a dedicated /home directory. For example, if you had a user named tester, your nginx.conf would say (the following works for me in Production:
server {
listen YOURIPADDRESSHERE:80; #use :443 if SSL is being used.
server_name YOURFULLDOMAINNAMEHERE;
#uncomment out following if ssl is used.
#ssl on;
#ssl_certificate /etc/ssl/private/YOUR_chained.crt;
#ssl_certificate_key /etc/ssl/private/YOUR.key;
#ssl_session_cache shared:SSL:1m;
#ssl_session_timeout 5m;
#ssl_protocols SSLv3 TLSv1;
#ssl_ciphers HIGH:MEDIUM;
#ssl_prefer_server_ciphers on;
root /home/tester/YOURRAILSAPPNAME/public; # <--- be sure to point to 'public'!
passenger_enabled on;
charset utf-8;
access_log /var/log/nginx/YOURFULLDOMAINNAMEHERE-ssl_access.log;
error_log /var/log/nginx/YOURFULLDOMAINNAMEHERE-ssl_error.log warn;
location /home/tester/YOURRAILSAPPNAME/public/ {
root html;
index index.html index.htm;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
Then make sure that your permissions are right (755 for all files, 644 for directories).
In my previous work I spent so much time in process of deploying rails apps to vps productions, with different configurations and gems, and finally before 9 months I discovered hatchbox.io service for deploying rails apps. It was built by Chris from GoRails and believe me it saved me so much time and nerves. This is not advertising but really service works perfect and its not expensive.
精彩评论