ubuntu20 本地gitlab设置https

修改配置文件
sudo vim /etc/gitlab/gitlab.rb

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

添加上面配置,添加nginx ssl证书路径

创建http跳转https的配置文件
sudo vim /var/opt/gitlab/nginx/conf/index.conf

server {
    listen *:80;
    server_name 192.168.61.128;
    rewrite ^(.*)$  https://$server_name$1 permanent;
}

载入刚才创建的配置文件
sudo vim /var/opt/gitlab/nginx/conf/nginx.conf
在文件中添加
include/var/opt/gitlab/nginx/conf/index.conf;
并且注释掉gzip on

保存退出

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
posted @ 2020-10-29 14:13  达芬奇vinic  阅读(414)  评论(0编辑  收藏  举报