Toggle navigation
Toggle navigation
This project
Loading...
Sign in
LI WENHAO
/
kartrider
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
김명주
2021-11-28 23:51:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5f863878ab7fee932e2a13aca0c5cbaf13253601
5f863878
1 parent
161aa98b
Change from local to https
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
main.js
main.js
View file @
5f86387
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
const
domain
=
"2019110627.osschatbot.ga"
;
const
sslport
=
23023
;
var
express
=
require
(
'express'
);
var
app
=
express
();
var
test
=
require
(
'./test.js'
);
...
...
@@ -29,6 +35,23 @@ app.get("/",(req,res)=>{
});
/* server */
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
);
}
/* local server
app.listen("8080",function(req,res){
console.log('server listening at port no. 8080');
});
*/
\ No newline at end of file
...
...
Please
register
or
login
to post a comment