Help us understand the problem. What is going on with this article?

Nginx経由のGitbucketに接続できない時の対処法

More than 1 year has passed since last update.

事象

  1. Gitbucketに接続出来ない事象が発生
  2. Nginxのerrorlogを確認
/var/log/nginx/error.log
[error]connect() failed (111: Connection refused) while connecting to upstream
  • なんとなく「upstream」が怪しそう・・・
  • 同じnginxからリバースプロキシしているredmineやsvnは上記のエラーは発生していない
  • 別サーバから参照していた場合も同様のエラーが発生する

とりあえず「connect() failed (111: Connection refused) while connecting to upstream」でググってみる

/etc/nginx/conf.d/default.conf
upstream unicorn-redmine {
    server unix:/opt/rails/redmine/tmp/sockets/unicorn.sock;
}

upstream unicorn-redmine-first {
    server unix:/opt/rails/redmine-first/tmp/sockets/unicorn.sock;
}

server {
    listen       80;
    server_name  $http_host;

・・・

   location /redmine {
        #proxy_pass http://127.0.0.1:8282/;
        proxy_pass http://unicorn-redmine;
    }

    location /gitbucket {
        proxy_pass              http://127.0.0.1:8080;
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout   150;
        proxy_send_timeout      100;
        proxy_read_timeout      100;
        proxy_buffers           4 32k;
        client_max_body_size    500m; # Big number is we can post big commits.
        client_body_buffer_size 128k;
    }

・・・

そもそもListen状態なのか確認

lsof -i:8080

⇒Listenしてない!
 ⇒Tomcatサービスが起動してない??

サービス起動確認

ps -aux

⇒Tomcatサービスが起動してない!

Tomcatサービス存在確認

systemctl list-units --type=service

原因

Tomcatサービスが起動してないことが原因

対応

Tomcatサービスを起動する

sudo systemctl start tomcat

Tomcatサービスは自動起動の設定にしてあるのになぜ???
誰かが意図的にサービスを停止させたとしか思えないが、、、

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away