[참고] 백엔드를 Node로 할 때 https 인증서 설치관련
링크
https://www.sslcert.co.kr/guides/Node-js-SSL-Certificates-Install (298) https://velog.io/@neity16/EC2-https%EC%84%A4%EC%A0%95Nodejsletsencrypt (209)참고로 - 관심이 별로 없으시겠지만... - 백엔드를 노드로 할 때 https 인증서 설치관련해서
443포트를 쓰지 않아도 되도록 인증서 판매업체에서
이런 예제를 제공해주고 있네요.
apache나 nginx를 쓰지 않아도...
-------------------
const https = require('https');
const fs = require('fs');
const options = {
key: fs.readFileSync('인증서경로/domain_xxxxx.key.pem'), (개인키 지정)
cert: fs.readFileSync('인증서경로/domain_xxxxx.crt.pem'), (서버인증서 지정)
ca: fs.readFileSync('인증서경로/ca-chain-bundle.pem'), (루트체인 지정)
minVersion: "TLSv1.2" (서버 환경에 따라 선택적 적용)
};
https.createServer(options, (req, res) => {
res.writeHead(200);
res.end('hello world\n');
}).listen(8000);
|
댓글을 작성하시려면 로그인이 필요합니다.
로그인
댓글 3개
https://velog.io/@alskt0419/Node.js-%EC%89%BD%EA%B2%8C-https-%EC%A0%81%EC%9A%A9-%EC%8B%9C%ED%82%A4%EB%8A%94-%EB%B2%95
여길보면 또 안그런 것 같기도하네요. 임의 포트를 사용해도 되는 것 같기도하고...
1024 아래의 포트는 루트만 실행시킬 수 있어서, 흠... 조금더 연구를... ㅎㅎ
...
좀 더 찾아보니,
아래 스마일서브 링크에서는 443을 쓰네요. 아마 위의 샘플이 잘못된 듯합니다.
https://idchowto.com/?p=51826