Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김영곤
/
2020-02-OSS-TermProject
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Authored by
김태영
2020-12-09 21:38:43 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
12fded52f87a8cd05e69cadaf8940a895021275f
12fded52
1 parent
98fb3521
update running server
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
bin/www
bin/www
View file @
12fded5
...
...
@@ -6,26 +6,38 @@
var
app
=
require
(
'../app'
);
var
debug
=
require
(
'debug'
)(
'2020-02-oss-termproject:server'
);
var
http
=
require
(
'http'
);
const
domain
=
"www.khumwd.ml"
const
sslport
=
8080
;
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
HTTPS
=
require
(
'https'
);
/**
* Get port from environment and store in Express.
*/
var
port
=
normalizePort
(
process
.
env
.
PORT
||
'
300
0'
);
var
port
=
normalizePort
(
process
.
env
.
PORT
||
'
808
0'
);
app
.
set
(
'port'
,
port
);
/**
* Create HTTP server.
*/
var
server
=
http
.
createServer
(
app
);
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
(),
};
var
server
=
HTTPS
.
createServer
(
option
,
app
).
listen
(
sslport
,
()
=>
{
console
.
log
(
`[HTTPS] Server is started on port
${
sslport
}
`
);
});
/**
* Listen on provided port, on all network interfaces.
*/
server
.
listen
(
port
);
server
.
on
(
'error'
,
onError
);
server
.
on
(
'listening'
,
onListening
);
...
...
Please
register
or
login
to post a comment