Recently, due to some problems with the previous domain name, I don’t know why it was blocked, resulting in the previous url has to be changed. Gitlab has been adding the host pointer and has not changed. Today, I have time to study it, and I found that there is no specific article on the Internet that describes the process of modifying the gitlab domain name, please record it.

1. Modify host in the gitlab configuration file

vi /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

Production: & base types# such
   # 1. GitLab app Settings ¬
   # = = = = = = = = = = = = = = = = = = = = = = = = = = types
 ¬
   # # GitLab Settings typesGitlab: such## Web server settings (note: host is the FQDN, do not include http://)¬Host: xxxxxxx.cn¬ // Original domain name port: 81¬ HTTPS:false
Copy the code

Example Change the host parameter to the new domain name yyYYYY

2. Modify the Gitlab configuration file in nginx

vi ~git/nginx/conf/gitlab-http.conf

server { listen *:81; server_name xxxxxxx.cn; . }Copy the code

Modify the server_name

3. Restart nginx and GitLab

sudo service nginx restart

sudo gitlab-ctl restart

4. Test whether the new domain name is normal

The browser is accessible and the SSH address in the project has been changed.

Example Change the git domain name of a local project

When updating native code:

git pull

ssh: Could not resolve hostname xxxxxxx.cn: Name or service not known

Git address:

git config -l

The url should be the old domain name

Git config remote.origin. Url yyYYYY

In an update:

git pull

Already up-to-date.

The problem has been solved.

Modify the gitlab-runner address in the project

sudo vi /etc/gitlab-runner/config.toml

Runners in the url

Restart gitlab – runner

sudo gitlab-runner restart

Gitlab – ci update url

When I mentioned the code today, I suddenly found that the build of GitLab was always in the pending state. I had never worked on GitLab before, so THE problem suddenly appeared and I felt a little confused. Later, I tried to restart Gitlab-Runner, but it didn’t have any effect. I think it might be the domain name before configuration.

sudo gitlab-runner restart

WARNING: Checking for builds… failed runner=*** status=couldn’t execute POST against http://gitlab.******.cn:81/ci/api/v1/builds/register.json: Post http://gitlab. * * *. Cn: 81 / ci/API/v1 / builds/register. The json: dial TCP: lookup gitlab. * * * * * *. Cn on 10.00.00.00:53: no such host

/etc/gitlab-runner/config.toml modify runners

sudo gitlab-runner restart

Build is finally not pending…

If you encounter new problems in this process, please add…