Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김대욱
/
OSS_PROJECT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김대욱
2020-12-10 15:48:19 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c84d92c5b7e663ecbefe9526e841933653324a7f
c84d92c5
1 parent
88d4c4b8
app.js v1.0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletions
nodejs/app.js
nodejs/app.js
View file @
c84d92c
const
request
=
require
(
'request'
);
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"www.osstestdw.ml"
const
sslport
=
23023
;
var
express
=
require
(
'express'
)
var
app
=
express
()
...
...
@@ -157,4 +162,17 @@ var server = app.listen(23023, function(){
console
.
log
(
'App listening at http://%s:%s'
,
host
,
port
)
})
try
{
const
option
=
{
ca
:
fs
.
readFileSync
(
'/etc/letsencrypt/live/'
+
domain
+
'/fullchain.pem'
),
key
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
domain
+
'/privkey.pem'
),
'utf8'
).
toString
(),
cert
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
domain
+
'/cert.pem'
),
'utf8'
).
toString
(),
};
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
);
}
...
...
Please
register
or
login
to post a comment