2017-10-13 4 views
0

Meine Anwendung zurückkehrt Fehler 502:Einhorn + Rails Refused-Verbindung auf Nginx Server

Im error.log:

2017/10/12 15:42:28 [Fehler] 12727 # 12727: * 415 connect() zu unix: /var/www/autonomos/production/current/tmp/sockets/unicorn.sock ist fehlgeschlagen (111: Verbindung abgelehnt), während die Verbindung zum Upstream hergestellt wurde, Client: 172.31.81.4, Server: api.autonomosapp.com .br, Anfrage: "GET/v1/auth/validate_token HTTP/1.1" stromaufwärts "http://unix:/var/www/autonomos/production/current/tmp/sockets/unicorn.sock:/v1/auth/validate_token" host: "api.autonomosapp.com.br"

Meine nginx/sites-enabled

upstream unicorn_autonomos_production { 
    server unix:/var/www/autonomos/production/current/tmp/sockets/unicorn.sock fail_timeout=0; 
} 

server { 
    listen 80; 
    #listen 443 ssl; 
    server_name api.autonomosapp.com.br; 
    root /var/www/autonomos/production/current/public; 

    access_log /var/www/autonomos/production/shared/log/access.log; 
    error_log /var/www/autonomos/production/shared/log/error.log; 

    client_max_body_size 500M; 
    keepalive_timeout 5; 
    gzip_types application/x-javascript text/css; 


    location /elb-status { 
    return 200; 
    } 

    location ~ /.well-known { 
    allow all; 
    root /var/www/autonomos/production/current/public; 
    } 


    location ~* ^/assets/ { 
    # Per RFC2616 - 1 year maximum expiry 
    # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 
    expires 1y; 
    add_header Cache-Control public; 

    # Some browsers still send conditional-GET requests if there's a 
    # Last-Modified header or an ETag header even if they haven't 
    # reached the expiry date sent in the Expires header. 
    add_header Last-Modified ""; 
    add_header ETag ""; 
    break; 
    } 

    location/{ 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header Host $http_host; 
    proxy_redirect off; 

    if (!-f $request_filename) { 
     proxy_pass http://unicorn_autonomos_production; 
     break; 
    } 
    } 

    error_page 500 502 503 504 /500.html; 
    location = /500.html { 
    root /var/www/autonomos/production/current/public; 
    } 
} 

nginx/nginx.conf

user www-data; 
worker_processes auto; 
pid /run/nginx.pid; 

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; # 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_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/javascript text/xml application/xml application/xml+rss text/javascript; 

    ## 
    # Virtual Host Configs 
    ## 

    include /etc/nginx/conf.d/*.conf; 
    include /etc/nginx/sites-enabled/*; 
} 

Meine etc/init/unicorn_autonomos_production

start on runlevel [2] 
stop on runlevel [016] 

console owner 

setuid autonomos 
pre-start exec /usr/local/rvm/bin/autonomos_production_unicorn_rails -E production -c /var/www/autonomos/production/current/config/unicorn.rb -D > /tmp/upstart_autonomos_production.log 2>&1 
post-stop exec kill `cat /var/www/autonomos/production/current/tmp/pids/unicorn.pid` 

respawn 

unicorn.stderr.log

I, [2017-10-10T04:24:00.952787 #2245] INFO -- : reaped #<Process::Status: pid 2248 exit 0> worker=0 
I, [2017-10-10T04:24:00.952946 #2245] INFO -- : master complete 

Mein unicorn_autonomos_production nicht in init.d , es ist ein Problem?

Wenn ich versuche:

service unicorn_autonomos_production start 

Der Fehler ist:

fehlgeschlagen unicorn_autonomos_production.service starten: Einheit unicorn_autonomos_production.service nicht gefunden.

Ich habe den Nginx-Server heute neu geladen, ich musste das Einhorn auch initialisieren? Wie kann ich?

Antwort

0

exec I den Befehl auf Terminal:

exec /usr/local/rvm/bin/autonomos_production_unicorn_rails -E production -c /var/www/autonomos/production/current/config/unicorn.rb -D > /tmp/upstart_autonomos_production.log 2>&1 

und init Einhorn

Verwandte Themen