赞
踩
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.*
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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。