장주현

ssl

Showing 1 changed file with 17 additions and 0 deletions
......@@ -6,6 +6,8 @@ const app = express();
const PAPAGO_URL = 'https://openapi.naver.com/v1/papago/n2mt'
const PAPAGO_ID = 'cIZBOTfISMHEyygh_NHp';
const PAPAGO_SECRET = '8D32UNGgYp';
const HTTPS = require('https');
const domain = "www.chatosscjh.tk"
const PORT = process.env.PORT || 3000;
//const indexRoute = require("./routes/index");
......@@ -123,3 +125,18 @@ function trans(message, totrans){
}
});
};
try {
const option = {
ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'),
key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/'$
cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/$
};
HTTPS.createServer(option, app).listen(sslport, () => {
console.log(`[HTTPS] Server is started on port ${sslport}`);
});
} catch (error) {
console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 $
console.log(error);
}
......