我在ubuntu14.04上設置nginx和獨角獸來訪問我的rails應用程序!nginx和獨角獸不工作
但是,我訪問我的域名,鉻responsed「連接被拒絕」
我不知道爲什麼......
我怎樣才能解決這個問題呢?
有我的nginx.conf和獨角獸文件。
【nginx.conf】
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# 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;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
#include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
【MYAPP - 麒麟】(在/ etc/nginx的//MYAPP,麒麟啓用站點)
upstream myapp.com {
#my rails app
server unix:/var/www/rails/myapp/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name myapp.com;
location/{
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 35M;
proxy_pass http://myapp.com;
}
}
【unicorn.rb】(/ VAR /www/rails/myapp/config/unicorn.rb)
感謝您耐心配合我可憐的英語。
添加
這是unicorn.log(/var/www/rails/myapp/log/unicorn.log)
I, [2015-09-05T18:17:20.590239 #10832] INFO -- : Refreshing Gem list
I, [2015-09-05T18:17:22.099133 #10832] INFO -- : unlinking existing socket=/var/www/rails/myapp/tmp/sockets/unicorn.sock
I, [2015-09-05T18:17:22.099389 #10832] INFO -- : listening on addr=/var/www/rails/myapp/tmp/sockets/unicorn.sock fd=11
I, [2015-09-05T18:17:22.115503 #10832] INFO -- : master process ready
I, [2015-09-05T18:17:22.118878 #10836] INFO -- : worker=0 ready
I, [2015-09-05T18:17:22.127008 #10839] INFO -- : worker=1 ready
這nginx.log(在/ var /日誌/ nginx的/ error.log中)
nginx的日誌是沒有的......
分享獨角獸和Nginx的錯誤日誌都 – Anatoly
謝謝你)你的回覆!我添加了日誌! –
Nginx錯誤日誌不應該爲空,查找詳細信息。它看起來像:*連接()失敗(111:連接被拒絕),同時連接到上游,客戶端.... *需要更多來自Nginx日誌的細節。嘗試重新命名上游,不要讓它看起來像FQDN。 – Anatoly