Showing
3 changed files
with
39 additions
and
0 deletions
Experiments/messenger/ssl/app.js
0 → 100644
| 1 | +const express = require('express'); | ||
| 2 | +const fs = require('fs'); | ||
| 3 | +const path = require('path'); | ||
| 4 | +const HTTPS = require('https'); | ||
| 5 | + | ||
| 6 | +const app = express(); | ||
| 7 | +const domain = "www.stagefive.tk" | ||
| 8 | +const sslport = 23023; | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +try { | ||
| 12 | + const option = { | ||
| 13 | + ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'), | ||
| 14 | + key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(), | ||
| 15 | + cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(), | ||
| 16 | + }; | ||
| 17 | + | ||
| 18 | + HTTPS.createServer(option, app).listen(sslport, () => { | ||
| 19 | + console.log(`[HTTPS] Server is started on port ${sslport}`); | ||
| 20 | + }); | ||
| 21 | +} catch (error) { | ||
| 22 | + console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); | ||
| 23 | + console.log(error); | ||
| 24 | +} | ||
| 25 | + |
Experiments/messenger/ssl/package-lock.json
0 → 100644
This diff is collapsed. Click to expand it.
Experiments/messenger/ssl/package.json
0 → 100644
-
Please register or login to post a comment