我试着在生产(vps)上运行我的rails应用程序。Nginx(111:连接被拒绝),同时连接到上游
我使用rbenv,麒麟,nginx的,操作系统Ubuntu的服务器..
我有配置麒麟和nginx的:
文件:配置/ unicorn.rb
app_dir = "/home/axx/apps/axx"
working_directory "/home/axx/apps/axx"
pid "/home/axx/apps/axx/tmp/pids/unicorn.pid"
stderr_path "/home/axx/apps/axx/unicorn/unicorn.log"
stdout_path "/home/axx/apps/axx/unicorn/unicorn.log"
listen "/home/axx/apps/axx/tmp/sockets/unicorn.axx.sock"
worker_processes 2
timeout 30
文件:/etc/nginx/sites-available/default
upstream app_server {
server unix:/home/axx/apps/axx/tmp/sockets/unicorn.axx.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root home/axx/apps/axx/public;
location/{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}
但是当我访问我的网站时,我得到502错误。此外,我去检查麒麟和nginx的:
的nginx/error.log中
connect() to unix:/home/axx/apps/axx/tmp/sockets/unicorn.axx.sock failed (111: Connection refused) while connecting to upstream,
我尝试站内搜索的一些问题,也太谷歌搜索,但我解决不了我的问题。
它看起来像独角兽不能创建袜子..这只是权限? – errata
@errata我已经更新了我的问题,现在我得到了111:拒绝连接 – itx
独角兽进程没有正确分叉...检查应用程序名称和路径。另外,我假设您也对网站进行了类似的更改,如果不是,请创建网站的符号链接 - 可用于启用网站的网站。 – RockStar