Showing
1 changed file
with
26 additions
and
21 deletions
| ... | @@ -6,34 +6,45 @@ | ... | @@ -6,34 +6,45 @@ |
| 6 | 6 | ||
| 7 | var app = require("../app"); | 7 | var app = require("../app"); |
| 8 | var debug = require("debug")("screensaver:server"); | 8 | var debug = require("debug")("screensaver:server"); |
| 9 | -var http = require("http"); | 9 | +const fs = require("fs"); |
| 10 | -const fs = require('fs'); | 10 | +const path = require("path"); |
| 11 | -const path = require('path'); | 11 | +const HTTPS = require("https"); |
| 12 | -const HTTPS = require('https'); | 12 | +const domain = "www.screensaver.ml"; |
| 13 | -const domain = "www.madcat.ga" | ||
| 14 | const sslport = 23023; | 13 | const sslport = 23023; |
| 15 | 14 | ||
| 16 | - | ||
| 17 | - | ||
| 18 | try { | 15 | try { |
| 19 | const option = { | 16 | const option = { |
| 20 | - ca: fs.readFileSync('/etc/letsencrypt/live/' + domain +'/fullchain.pem'), | 17 | + ca: fs.readFileSync("/etc/letsencrypt/live/" + domain + "/fullchain.pem"), |
| 21 | - key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/privkey.pem'), 'utf8').toString(), | 18 | + key: fs |
| 22 | - cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain +'/cert.pem'), 'utf8').toString(), | 19 | + .readFileSync( |
| 20 | + path.resolve( | ||
| 21 | + process.cwd(), | ||
| 22 | + "/etc/letsencrypt/live/" + domain + "/privkey.pem" | ||
| 23 | + ), | ||
| 24 | + "utf8" | ||
| 25 | + ) | ||
| 26 | + .toString(), | ||
| 27 | + cert: fs | ||
| 28 | + .readFileSync( | ||
| 29 | + path.resolve( | ||
| 30 | + process.cwd(), | ||
| 31 | + "/etc/letsencrypt/live/" + domain + "/cert.pem" | ||
| 32 | + ), | ||
| 33 | + "utf8" | ||
| 34 | + ) | ||
| 35 | + .toString(), | ||
| 23 | }; | 36 | }; |
| 24 | 37 | ||
| 25 | HTTPS.createServer(option, app).listen(sslport, () => { | 38 | HTTPS.createServer(option, app).listen(sslport, () => { |
| 26 | console.log(`[HTTPS] Server is started on port ${sslport}`); | 39 | console.log(`[HTTPS] Server is started on port ${sslport}`); |
| 27 | }); | 40 | }); |
| 28 | } catch (error) { | 41 | } catch (error) { |
| 29 | - console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); | 42 | + console.log( |
| 43 | + "[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다." | ||
| 44 | + ); | ||
| 30 | console.log(error); | 45 | console.log(error); |
| 31 | } | 46 | } |
| 32 | 47 | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | /** | 48 | /** |
| 38 | * Get port from environment and store in Express. | 49 | * Get port from environment and store in Express. |
| 39 | */ | 50 | */ |
| ... | @@ -42,12 +53,6 @@ var port = normalizePort(process.env.PORT || "8080"); | ... | @@ -42,12 +53,6 @@ var port = normalizePort(process.env.PORT || "8080"); |
| 42 | app.set("port", port); | 53 | app.set("port", port); |
| 43 | 54 | ||
| 44 | /** | 55 | /** |
| 45 | - * Create HTTP server. | ||
| 46 | - */ | ||
| 47 | - | ||
| 48 | -var server = http.createServer(app); | ||
| 49 | - | ||
| 50 | -/** | ||
| 51 | * Listen on provided port, on all network interfaces. | 56 | * Listen on provided port, on all network interfaces. |
| 52 | */ | 57 | */ |
| 53 | 58 | ... | ... |
-
Please register or login to post a comment