在Ubuntu 12.04 for Rails 3.2.8环境中设置Nginx和Passenger

我是一个新手,喜欢语言和开发环境。 不过,当我不使用PostgreSQL和/或Heroku的时候,我试图将一个新的应用程序推送到生产环境,我感到非常沮丧。

由于工作相关的原因,我们使用一个以MySQL为数据库的rackspace云服务器。

设置乘客和Nginx,我感到沮丧。 我已经跟随Ryan的Railscasts 部署到VPS和本教程。

我可以通过在服务器上安装ruby,mysql,passenger,Nginx,dependencies和rails。 但是当我尝试启动Nginx时,没有任何反应。 当我说什么都没有发生,我的意思是我没有任何迹象表明它正在运行。 我指向我的浏览器的IP地址,并在浏览器中收到标准错误“此网页不可用”错误。 我看过错误日志,它是空白的。 我还没有部署我的应用程序…只是想看看Nginx的默认屏幕。

有任何想法吗? 我猜测在configurationNginx时我缺less一个关键的步骤,我只是不知道它是什么。

我的访问日志

.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)" 

我的Nginx.conf文件

 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

你至少失踪了passenger_enabled on;

我的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 http://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; } } }