我是Ruby on Rails的初学者,并且部署我的rails应用程序(使用nginx + unicorn)时遇到一些困难。我不知道发生了什么事情,但在这里是一种错误的我在日志文件中得到,当我启动nginx的:RoR - 尝试与独角兽部署时的nginx问题
2013/04/14 00:31:42 [error] 14469#0: *1 connect() to unix:/home/user/www/sahitoo/shared/sockets/unicorn.sock
**failed (111: Connection refused)** while connecting to upstream, client: XX.XXX.XX.XX, server: myapp.com,
request: "GET/HTTP/1.1", upstream: "http://unix:/home/user/www/sahitoo/shared/sockets/unicorn.sock:/",
host: "www.XXXXX.com"
如果你能帮忙找出问题,或至少给我一些建议跟踪它,这将是非常好的! 非常感谢。
我也交nginx.conf文件:
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
upstream sahitoo {
server unix:/home/kar/www/sahitoo/shared/sockets/unicorn.sock;
}
}
随着 的/ etc/nginx的/启用的站点 -/sahitoo文件:
server {
listen 80;
server_name myapp.com;
access_log /var/log/nginx/sahitoo.access.log;
error_log /var/log/nginx/sahitoo.error.log;
root /www/sahitoo/public;
# direct to maintenance if this file exists
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
location/{
proxy_redirect http://sahitoo/ /;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# If the file exists as a static file serve it directly
if (-f $request_filename) {
break;
}
if (!-f $request_filename) {
proxy_pass http://sahitoo;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /home/kar/www/sahitoo/public;
}
}
似乎像独角兽没有运行。 – Intrepidd
感谢Intrepidd,独角兽也给我错误,也许确实是源头问题...... Je peux te contacter enprivé? –