我是rails的新手,热爱语言和开发环境.但是,在不使用Postgresql和/或Heroku的情况下尝试将新应用程序推送到生产环境时,我一直非常沮丧.
出于工作原因,我们使用机架式云服务器,将MySQL作为数据库.
设置乘客和Nginx让我感到沮丧.我在deploying to vps和this教程中关注了Ryan的Railscasts.
我可以在服务器上安装ruby,MysqL,passenger,Nginx,依赖项和rails.但是当我尝试启动Nginx时没有任何反应.当我说没有任何反应时,我的意思是我没有任何迹象表明它正在运行.我将浏览器指向IP地址,并在浏览器中收到标准错误“此网页不可用”错误.我查看了错误日志,它是空白的.我还没有部署我的应用程序……只是想看看Nginx的默认屏幕.
有任何想法吗?我猜测在配置Nginx时我缺少一个关键步骤我只是不知道它是什么.
我的访问日志
.0.0.1 - - [14/Oct/2012:10:40:03 -0500] "GET / HTTP/1.1" 200 151 "-" "Wget/1.13.4 (linux-gnu)"
127.0.0.1 - - [14/Oct/2012:10:45:03 -0500] "GET / HTTP/1.1" 200 151 "-" "Wget/1.13.4 (linux-gnu)"
127.0.0.1 - - [14/Oct/2012:10:50:03 -0500] "GET / HTTP/1.1" 200 151 "-" "Wget/1.13.4 (linux-gnu)"
127.0.0.1 - - [14/Oct/2012:10:55:03 -0500] "GET / HTTP/1.1" 200 151 "-" "Wget/1.13.4 (linux-gnu)"
127.0.0.1 - - [14/Oct/2012:11:00:03 -0500] "GET / HTTP/1.1" 200 151 "-" "Wget/1.13.4 (linux-gnu)"
user deployer staff;
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/Nginx.pid;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.17;
passenger_ruby /usr/local/bin/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
解决方法:
从我的博客文章,这几乎是在这个确切的设置http://blog.nikoroberts.com/post/45834702235/setting-up-a-rails-32-server-in-the-rackspace
你至少失踪了
乘客启用;
我的Nginx.conf
worker_processes 4;
events {
worker_connections 1024;
}
http {
passenger_root /home/deployer/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17;
passenger_ruby /home/deployer/.rvm/wrappers/ruby-1.9.3-p194/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 5M;
gzip on;
gzip_http_version 1.1;
gzip_comp_level 1;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_proxied any;
gzip_vary on;
gzip_min_length 500;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+RSS text/javascript;
passenger_default_user deployer;
#fast passenger respawn
passenger_pool_idle_time 1000;
server {
listen 80;
charset utf-8;
server_name localhost;
root /var/www/contactguru/current/public;
passenger_enabled on;
rails_env production;
# fast passenger and rails respawn
# from https://stackoverflow.com/a/2329221
rails_spawn_method smart;
rails_app_spawner_idle_time 0;
rails_framework_spawner_idle_time 0;
location ~ ^/(assets)/ {
root /var/www/contactguru/current/public;
gzip_static on;
expires max;
add_header Cache-Control public;
# access_log /dev/null;
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。