[英]Rails 5 app with Puma and Nginx - 111: Connection refused while connecting to upstream, client
[英]Nginx (111: Connection refused) while connecting to upstream
我嘗試在生產(vps)上運行我的Rails應用程序。
我正在使用rbenv,獨角獸,nginx,操作系統ubuntu服務器。
我有配置獨角獸和Nginx:
文件: config / 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,
我嘗試在該站點中搜索一些問題,也進行了谷歌搜索,但是我無法解決問題。
檢查/etc/nginx/nginx.conf
文件和/etc/nginx/nginx.conf
文件的路徑。 就我而言,我缺少當前文件夾目錄名稱。
檢查您的server unix:/home/axx/apps/axx/tmp/sockets/unicorn.axx.sock
在上游塊中的路徑。 您可能缺少正確的路徑,因為我缺少當前的文件夾名稱。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.