Skip to content

ong-ar/local-ssl-with-nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

사용법

설정된 모든 도메인은 3000번 포트로 향해있습니다.

0. clone

git clone https://github.com/ong-ar/local-ssl-with-nginx.git

cd local-ssl-with-nginx

(1~3단계 쉘스크립트) install.sh 실행


or


1. mkcert 설치 및 인증서 생성

mkcert is a simple tool for making locally-trusted development certificates.

$ brew install mkcert

$ mkcert -install

$ mkcert -cert-file=./ssl/all.crt -key-file ./ssl/all.key "*.local.kcd.co.kr" "*.local.cashnote.kr"

2. 실행

$ docker-compose up -d

3. /etc/hosts 수정

$ echo '127.0.0.1   merlin.local.cashnote.kr kestrel.local.cashnote.kr space.local.kcd.co.kr' | sudo tee -a /etc/hosts

4. chrome 에서 확인

  • merlin.local.cashnote.kr
  • kestrel.local.cashnote.kr
  • space.local.kcd.co.kr

설정 방법

도메인 추가하는 방법

  • 위 설정에서는 *.local.kcd.co.kr *.local.cashnote.kr 서브도메인에 대해서는 인증서가 있다라는 뜻

만약 merlin.local.cashnote.kr 도메인을 localhost:4000 포트로 설정하고 싶다면 아래와 같이 설정

에디터로 nginx/conf.d/local.cashnote.kr.conf 열고 아래 코드 추가

server {
    listen 443 ssl;
    server_name merlin.local.cashnote.kr;

    location / {
        proxy_pass http://host.docker.internal:4000;
    }
}
$ docker-compose restart

만약 a.local.kcd.co.kr 또는 a.local.cashnote.kr 을 추가하고 싶다면 아래와 같이 설정

$ sudo vi /etc/hosts
127.0.0.1 a.local.kcd.co.kr a.local.cashnote.kr

만약 a.example.com 을 추가하고 싶다면 아래와 같이 설정

$ mkcert -cert-file=./ssl/all.crt -key-file ./ssl/all.key "*.local.kcd.co.kr" "*.local.cashnote.kr" "*.example.com"

$ docker-compose restart
$ sudo vi /etc/hosts
127.0.0.1 a.example.com

삭제 방법

$ mkcert -uninstall
$ brew uninstall mkcert
$ docker-compose down
  • /etc/hosts 정리

About

KCD 에서 사용할 로컬 개발 인증서가 추가 된 웹서버

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages