当前位置:   article > 正文

gitlab生成证书支持HTTPS方式_网页端gitlab证书

网页端gitlab证书

一: 证书生成:

1. 创建 Private Key,这里需要输入密码,记住下密码,在下面需要用到

openssl genrsa -des3 -out /etc/gitlab/ssl/git.zhubanxian.com.key 2048

2. 生成 Certificate Request

openssl req -new -key /etc/gitlab/ssl/git.zhubanxian.com.key -out /etc/gitlab/ssl/git.zhubanxian.com.csr

输入一些信息

Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:clark
Locality Name (eg, city) [Default City]:beijing
Organization Name (eg, company) [Default Company Ltd]:zhubanxian
Organizational Unit Name (eg, section) []:zhubanxian
Common Name (eg, your name or your server's hostname) []:zhubanxian
Email Address []:zhuwei680913@163.com
 
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:123456789
An optional company name []:zhubanxian

上面2条命令可以进行合并

openssl req -nodes -newkey rsa:2048 -keyout git.zhubanxian.com.key -out git.zhubanxian.com.csr

3. 移除Private Key 中的密码短语

cp -v /etc/gitlab/ssl/git.zhubanxian.com.{key,original}
openssl rsa -in /etc/gitlab/ssl/git.zhubanxian.com.original -out /etc/gitlab/ssl/git.zhubanxian.com.key
rm -v /etc/gitlab/ssl/git.zhubanxian.com.original

4. 创建证书

openssl x509 -req -days 1460 -in /etc/gitlab/ssl/git.zhubanxian.com.csr -signkey /etc/gitlab/ssl/git.zhubanxian.com.key -out /etc/gitlab/ssl/git.zhubanxian.com.crt

5. 移除证书请求文件

rm -v /etc/gitlab/ssl/git.zhubanxian.com.csr 

6. 设置文件权限

chmod 600 /etc/gitlab/ssl/git.zhubanxian.com.*

 二:gitlab 配置更改

vim /etc/gitlab/gitlab.rb
external_url 'https://git.zhubanxian.com'
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate']= "/etc/gitlab/ssl/git.zhubanxian.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/git.zhubanxian.com.key"

重新加载配置文件

gitlab-ctl reconfigure

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/208003
推荐阅读
相关标签
  

闽ICP备14008679号