Showing
1 changed file
with
36 additions
and
78 deletions
... | @@ -4,81 +4,39 @@ | ... | @@ -4,81 +4,39 @@ |
4 | * Module dependencies. | 4 | * Module dependencies. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | -var app = require("../app"); | 7 | + var app = require("../app"); |
8 | -var debug = require("debug")("myapp:server"); | 8 | + var https = require("https"); |
9 | -var https = require("https"); | 9 | + var path = require('path'); |
10 | -var fs=require("fs"); | 10 | + var fs = require("fs"); |
11 | - | 11 | + |
12 | -const domain = "도메인 입력"; | 12 | + const domain = "도메인주소 입력"; |
13 | -const sslport = 3000; | 13 | + const sslport = 3000; |
14 | - | 14 | + |
15 | -const option = { | 15 | + const option = { |
16 | - ca: fs.readFileSync("/etc/letsencrypt/live/" + domain + "/fullchain.pem"), | 16 | + ca: fs.readFileSync("/etc/letsencrypt/live/" + domain + "/fullchain.pem"), |
17 | - key: fs | 17 | + key: fs |
18 | - .readFileSync( | 18 | + .readFileSync( |
19 | - path.resolve( | 19 | + path.resolve( |
20 | - process.cwd(), | 20 | + process.cwd(), |
21 | - "/etc/letsencrypt/live/" + domain + "/privkey.pem" | 21 | + "/etc/letsencrypt/live/" + domain + "/privkey.pem" |
22 | - ), | 22 | + ), |
23 | - "utf8" | 23 | + "utf8" |
24 | - ) | 24 | + ) |
25 | - .toString(), | 25 | + .toString(), |
26 | - cert: fs | 26 | + cert: fs |
27 | - .readFileSync( | 27 | + .readFileSync( |
28 | - path.resolve( | 28 | + path.resolve( |
29 | - process.cwd(), | 29 | + process.cwd(), |
30 | - "/etc/letsencrypt/live/" + domain + "/cert.pem" | 30 | + "/etc/letsencrypt/live/" + domain + "/cert.pem" |
31 | - ), | 31 | + ), |
32 | - "utf8" | 32 | + "utf8" |
33 | - ) | 33 | + ) |
34 | - .toString(), | 34 | + .toString(), |
35 | -}; | 35 | + }; |
36 | - | 36 | + |
37 | -/** | 37 | + /** |
38 | - * Create HTTPS server. | 38 | + * Create HTTPS server. |
39 | - */ | 39 | + */ |
40 | -https.createServer(option, app).listen(sslport, () => { | 40 | + https.createServer(option, app).listen(sslport, () => { |
41 | - console.log(`[HTTPS] Server is started on port ${sslport}`); | 41 | + console.log(`[HTTPS] Server is started on port ${sslport}`); |
42 | -}); | 42 | + }); |
43 | - | ||
44 | -/** | ||
45 | - * Listen on provided port, on all network interfaces. | ||
46 | - */ | ||
47 | -server.on("error", onError); | ||
48 | -server.on("listening", onListening); | ||
49 | - | ||
50 | -/** | ||
51 | - * Event listener for HTTP server "error" event. | ||
52 | - */ | ||
53 | - | ||
54 | -function onError(error) { | ||
55 | - if (error.syscall !== "listen") { | ||
56 | - throw error; | ||
57 | - } | ||
58 | - | ||
59 | - var bind = typeof port === "string" ? "Pipe " + port : "Port " + port; | ||
60 | - | ||
61 | - // handle specific listen errors with friendly messages | ||
62 | - switch (error.code) { | ||
63 | - case "EACCES": | ||
64 | - console.error(bind + " requires elevated privileges"); | ||
65 | - process.exit(1); | ||
66 | - break; | ||
67 | - case "EADDRINUSE": | ||
68 | - console.error(bind + " is already in use"); | ||
69 | - process.exit(1); | ||
70 | - break; | ||
71 | - default: | ||
72 | - throw error; | ||
73 | - } | ||
74 | -} | ||
75 | - | ||
76 | -/** | ||
77 | - * Event listener for HTTP server "listening" event. | ||
78 | - */ | ||
79 | - | ||
80 | -function onListening() { | ||
81 | - var addr = server.address(); | ||
82 | - var bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port; | ||
83 | - debug("Listening on " + bind); | ||
84 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment