How to change port GitLab on CentOS 6?

2019-04-17 07:12发布

I tried to change port number on these files. But when I run gitlab-ctl reconfigure for updating. I can't access my link (http://myaddress.example:8790) Those files which I changed are:

/var/opt/gitlab/gitlab-rails/etc/gitlab.yml

/opt/gitlab/embedded/conf/nginx.conf

/opt/gitlab/embedded/cookbooks/gitlab/attributes/default.rb

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

/var/opt/gitlab/nginx/conf/gitlab-http.conf

In /etc/gitlab/gitlab.rb I change external_url "http://myaddress.example:8790"

How can I fix it?

2条回答
Animai°情兽
2楼-- · 2019-04-17 07:51

Using GIT_LAB_PATH as you gitlab base directory (the root where is it installed)

  • Modify GIT_LAB_PATH/gitlab/gitlab.yml
## GitLab settings
gitlab:
## Web server settings
host: HOSTNAME
port: HTTP_PORT
https: false
  • If you use non-standard ssh port you need to specify it

    ssh_port: SSH_PORT

  • Modify GIT_LAB_PATH/gitlab-shell/config.yml to use the new HTTP port:

Url to gitlab instance. Used for api calls. Should end with a slash.

gitlab_url: "http://HOSTNAME:HTTP_PORT/"
  • Modify /etc/nginx/sites-available/gitlab

    listen *:HTTP_PORT default_server; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea

  • Modify /etc/ssh/sshd_config

What ports, IPs and protocols we listen for

Port SSH_PORT
  • Restart SSH, restart GitLab, restart nginx:

    sudo service ssh restart sudo service gitlab restart sudo service nginx restart

  • Test GitLab:

    sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

  • Update the remote origins for your repos to use the new port:

ssh://git@HOSTNAME:HTTP_PORT/repo_name

查看更多
贪生不怕死
3楼-- · 2019-04-17 08:09

Dear all I missing open port in firewall I type it on linu terminal

/etc/init.d/iptables stop

It worked

查看更多
登录 后发表回答