docker搭建的gitlab通过域名访问

x33g5p2x  于2022-05-25 转载在 Docker  
字(1.0k)|赞(0)|评价(0)|浏览(660)

docker ps 查看已经安装好的gitlab,80,443端口也已经打开。

搭建好gitlab后,需要能让外网访问https访问到。

docker安装gitlab的时候,已经集成nginx只需要配置Nginx即可完成。

进行dns域名解析,直接指向gitleb的公网IP地址

进入docker内部,编辑gitlab.rb文件

external_url 'https://gitlab.geexek.com.cn'
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.geexek.com.cn.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.geexek.com.cn.key"

nginx['proxy_set_headers'] = {
  "X-Forwarded-Proto" => "https",
  "X-Forwarded-Ssl" => "on"
 }

修改docker内部,gitlab自己带的Nginx的配置

server {
  listen *:443 ssl http2;

  server_name gitlab.geexek.com.cn;
  server_tokens off; ## Don't show the nginx version number, a security best practice

  ## Increase this if you want to upload large attachments
  ## Or if you want to accept large git objects over http
  client_max_body_size 0;

  ## Strong SSL Security
  ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
  ssl on;
  ssl_certificate /etc/gitlab/ssl/gitlab.geexek.com.cn.crt;
  ssl_certificate_key /etc/gitlab/ssl/gitlab.geexek.com.cn.key;
}

重新启动docker服务,即可访问

相关文章