GitLab was configured on Ali Cloud today, but the error 502 error kept coming up.
502
GitLab is not responding.
Please contact your GitLab administrator if this problem persists.
After searching for one afternoon, a mistake was finally found. It turned out that a Tomcat service was opened on the server and occupied port 8080, which made the Unicorn service of GitLab unable to be opened.
is finally modified as follows in /etc/gitlab/gitlab.rb
unicorn['port'] = 9090
Then gitlab-ctl reconfigure
restart the configuration so that the gitlab server is up and running.
Here, write down the general process of solving the problem, and count it as a good experience for yourself.
install GitLab, start service, 502 error found. This is the beginning of the search for solutions to various Baidu.
1. Find the /var/log/gitlab/nginx code> in the error log file, found the following error /var/opt/gitlab/gitlab - rails/sockets/gitlab socket failed (2: No such file or directory)
, and then use the nc command to create the socket file, the final permission is set to SRWXRWXRWX
, users and groups are set to git:git, but found that this method does not work.
2. When I ran to the GitLab website to find a solution, https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
CTRL + f 502 find the official tutorial says 502 problems
Note that on a single-core server it may take up to a minute to restart Unicorn and Sidekiq. Your GitLab instance will give a 502 error until Unicorn is up again.
It is also possible to start, stop or restart individual components.
sudo gitlab-ctl restart sidekiq
Unicorn supports zero-downtime reloads. These can be triggered as follows:
sudo gitlab-ctl hup unicorn
Note that you cannot use a Unicorn reload to update the Ruby runtime.
Try using the above two commands and find that it doesn't work. When I got angry, I kept typing gitlab-ctl status
until I found that unicorn pid was getting bigger all the time. The PID for the other services has not changed.
3. Now we've almost found the problem -- unicorn's question. For the official tutorial, you can use gitlab-ctl tail unicorn
to track the unicorn's status. Unfortunately, when we discovered that port 8080 was occupied, the unicorn's status was reported to have been captured
E, [2015-02-11T17:27:57.818492 #26687] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2015-02-11T17:27:57.818621 #26687] ERROR -- : retrying in 0.5 seconds (4 tries left)
E, [2015-02-11T17:27:58.318902 #26687] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2015-02-11T17:27:58.318998 #26687] ERROR -- : retrying in 0.5 seconds (3 tries left)
E, [2015-02-11T17:27:58.819309 #26687] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2015-02-11T17:27:58.819423 #26687] ERROR -- : retrying in 0.5 seconds (2 tries left)
E, [2015-02-11T17:27:59.319954 #26687] ERROR -- : adding listener failed addr=127.0.0.1:8080 (in use)
E, [2015-02-11T17:27:59.320076 #26687] ERROR -- : retrying in 0.5 seconds (1 tries left)
4. Well, here's the problem. The choice then became whether to kill the original 8080 port service or to change the unicorn port. This depends on your specific needs. I've changed the unicorn port to 9090, and the method is the one described at the beginning.