route53 퍼블릭 호스트존에 해당 도메인에 등록
git clone https://github.com/hibuz/nginx-certbot.git
# 8번째 줄
domains=gitlab.literaryyusa.com
# 11번째 줄
email="gin9815@gmail.com" # Adding a valid address is strongly recommended
server {
listen 80;
server_name gitlab.literaryyusa.com
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name gitlab.literaryyusa.com
server_tokens off;
ssl_certificate /etc/letsencrypt/live/gitlab.literaryyusa.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/gitlab.literaryyusa.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://gitlab.literaryyusa.com;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
./ init-letsencrypt.sh 실행
잘 들어가 지는지, 확인 한번하고 저기 자물쇠눌러서 인증서 잘 붙어있는지 확인하면 된다.!
docker-compuse up --build -d
[root@ip-10-1-4-188 ~]# cat docker-compose.yml
version: '3.6'
services:
gitlab:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab
restart: always
hostname: 'gitlab.literaryyusa.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.literaryyusa.com'
ports:
- "${원하는 포트}:80"
- "${원하는 포트}:22"
- "${원하는 포트}:443"
volumes:
- '$HOME/gitlab/config:/etc/gitlab'
- '$HOME/gitlab/logs:/var/log/gitlab'
- '$HOME/gitlab/data:/var/opt/gitlab'
- '$HOME/gitlab/backups:/var/opt/gitlab/backups/'
docker exec -it gitlab /bin/bash
vi /etc/gitlab/gitlab.rb
아래 4개 값 변경
external_url 'https://gitlab.literaryyusa.com'
nginx['enable'] = true
nginx['redirect_http_to_https'] = true
nginx['redirect_http_to_https_port'] = 80
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.literaryyusa.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.literaryyusa.com.key"
gitlab-ctl reconfigure
https 로 되고있고, 인증서가 나오고있음...!