2 min read

고스트 이메일 인증문제

고스트 이메일 인증문제
Photo by Kelly Sikkema / Unsplash

고스트 배포 후에 특정 브라우저로만 들어가지는 이슈 발생

Failed to send email. Please check your site configuration and try again.

고스트 5.x 버전부터는 이메일 매직링크로 들어가는 방식으로 보안이 강화됐다.

그래서 이메일 인증 설정을 추가 해줘야 한다. 세팅을 해줘야 메일로 보안코드를 알려준다.

일단 '앱 비밀번호'를 생성해야 한다.
https://support.google.com/accounts/answer/185833?hl=ko

여기서 생성할 이름은 적당히(ex: ghost) 해서 하나 만들면
mzts uxxx xxxx xxxx

이런 형태의 비밀번호를 생성한다. 메모하고...

yml을 수정해줘야 한다.
config.production.json 파일을 직접 수정해도 되지만 아래처럼 수정된 json파일을 넣어줘도 된다.

volumes:
  - /docker/ghost/content:/var/lib/ghost/content
  - /docker/ghost/config.production.json:/custom/config.production.json
command: >
  bash -c "cp /custom/config.production.json /var/lib/ghost/config.production.json && docker-entrypoint.sh node current/index.js"

config.production.json 파일을 미리 작성해서 고스트 도커에 넣는 방식으로 해결했다. config.production.json 기본값은...

root@6145d7973586:/var/lib/ghost# cat /var/lib/ghost/config.production.json 
{
  "url": "http://localhost:2368",
  "server": {
    "port": 2368,
    "host": "::"
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "security": {
    "staffDeviceVerification": true
  },
  "paths": {
    "contentPath": "/var/lib/ghost/content"
  }
}

수정된 값이다.

root@62cddc6f41d9:/var/lib/ghost# cat /var/lib/ghost/config.production.json 
{
  "url": "https://edit.edit.co.kr",
  "server": {
    "port": 2368,
    "host": "0.0.0.0"
  },
  "mail": {
  "transport": "SMTP",
  "options": {
    "service": "Gmail",
    "auth": {
      "user": "edit@edit.com",
      "pass": "eist edit edit csdf"
      }
    },
    "from": "'edit' <edit@edit.com>"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "paths": {
    "contentPath": "/var/lib/ghost/content"
  }
}

이런식으로 미리 넣어놓고 재기동 하니 다른 브라우저 에서도 인증메일 화면으로 넘어간다.

  • 도커스웜으로 고스트 배포합니다.
  • traefik을 이용한 리버스 프록시, 보안인증까지 진행합니다.

    배포는 매니저에서, json파일은 워커노드에 있어야 합니다.
  • 상세한 방법을 알고 싶으면 댓글로 문의 바랍니다.