Ruby on rails 主机启动失败,请查看stderr日志以了解详细信息。独角兽&x2B;Nginx+;轨道

Ruby on rails 主机启动失败,请查看stderr日志以了解详细信息。独角兽&x2B;Nginx+;轨道,ruby-on-rails,nginx,unicorn,Ruby On Rails,Nginx,Unicorn,我正在使用ruby 2.6.5开发rails 6应用程序,我正在尝试使用Unicorn和Nginx在lenode服务器上配置我的应用程序。 我关注了以下文章:- config/unicorn.rb # set path to the application app_dir = File.expand_path("../..", __FILE__) shared_dir = "#{app_dir}/shared" working_directory app

我正在使用ruby 2.6.5开发rails 6应用程序,我正在尝试使用Unicorn和Nginx在lenode服务器上配置我的应用程序。 我关注了以下文章:-

config/unicorn.rb

# set path to the application
app_dir = File.expand_path("../..", __FILE__)
shared_dir = "#{app_dir}/shared"
working_directory app_dir

# Set unicorn options
worker_processes 2
preload_app true
timeout 30

# Path for the Unicorn socket
listen "#{shared_dir}/sockets/unicorn.sock", :backlog => 64

# Set path for logging
stderr_path "#{shared_dir}/log/unicorn.stderr.log"
stdout_path "#{shared_dir}/log/unicorn.stdout.log"

# Set proccess id path
pid "#{shared_dir}/pids/unicorn.pid"
/etc/nginx/nginx.conf

user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.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;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # 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/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 rails {
         # Path to Unicorn socket file
         server unix:/home/myicourse/shared/sockets/unicorn.sock fail_timeout=0;
       }
}
/etc/nginx/可用站点/myicourse

 server {
    listen 80;
    server_name localhost;
    
    root /home/myicourse;
    
    try_files $uri/index.html $uri @rails;
    
    location @rails {
       proxy_pass http://rails;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
       proxy_redirect off;
    }
    
    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;
    }
当我试图使用命令
sudo unicorn-c config/unicorn.rb-E production-D
启动unicorn时,它抛出错误消息
“master无法启动,请查看stderr日志了解详细信息”

共享/log/unicorn.stderr.log

from config.ru:4:in `block in <main>'
    from /usr/lib/ruby/vendor_ruby/rack/builder.rb:55:in `instance_eval'
    from /usr/lib/ruby/vendor_ruby/rack/builder.rb:55:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /usr/lib/ruby/vendor_ruby/unicorn.rb:54:in `eval'
    from /usr/lib/ruby/vendor_ruby/unicorn.rb:54:in `block in builder'
    from /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:794:in `build_app!'
    from /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:141:in `start'
    from /usr/bin/unicorn:128:in `<main>'
你能指导我如何解决这个问题吗?提前谢谢。 PS:我正在使用root用户配置应用程序

2020/10/25 18:14:38 [error] 278484#278484: *4 connect() to unix:/home/myicourse/shared/sockets/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 177.50.212.149, server: localhost, request: "GET / HTTP/1.1", upstream: "http://unix:/home/myicourse/shared/sockets/unicorn.sock:/500.html", host: "172.105.49.196:80"