443 서버로 https 여니까 서버 접속이 안되는데

443 서버로 https 여니까 서버 접속이 안되는데

작성일 2023.07.16댓글 1건
    게시물 수정 , 삭제는 로그인 필요

ZEROSSL 으로 발급 했고요.
내부 외부 다 안됩니다 LOCALHOST도 안됨.
코드입니다
const express = require("express");
const expressSanitizer = require("express-sanitizer");
const https = require("https");
const fs = require("fs");
const options = {
  key: fs.readFileSync("c:/private.key"),
  cert: fs.readFileSync("c:/certificate.crt"),
 
};
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(expressSanitizer());
app.use("/", express.static("public"));
const port  = 443;
const ip = '192.168.123.111'
var server = server = https.createServer(function(request,response) {
  response.writeHead(200,{'Content-Type':'text/html'});
  response.end('curung server');
});
server.listen(port,ip,() => {
  console.log("서버가",port, "포트에서 열리며" ,ip, "ip에서 열립니다.");
});



profile_image 익명 작성일 -

내부, localhost 당연히 https로 안 열립니다.

인증서를 신청할 때 넣어던 도메인, 호스트.도메인 으로 접근해야 합니다.

예를 들어서,

www.abc.com이나 abc.com처럼 공인 도메인이어야 합니다.

내부에서 테스트해보려면,

hosts 파일에,

abc.com 192.168.123.111

www.abc.com 192.168.123.111

두 줄을 넣습니다.

외부에서 확인하려면,

abc.com의 네임서버 영역파일에,

A @ 외부아이피

A www 외부아이피

가 들어가져 있어야 합니다.

또한,

443포트가 192.168.123.111으로 포워딩돼 있어야 합니다.