-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
75 lines (50 loc) · 2.02 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Here is a minimal but fully featured web server written in Node javascript.
It easily allows to deploy a websocket-enabled web server that works in http
and https.
Dependences:
npm install websocket
npm install toml
You do not need the websocket module if you do not enable websockets.
To generate a self-signed certificate for https:
$ openssl genrsa -out key.pem
$ openssl req -new -key key.pem -out csr.pem
$ openssl x509 -req -days 3652 -in csr.pem -signkey key.pem -out cert.pem
$ rm csr.pem
Settings, relative paths start from the same directory where is server.js.
server section, self explanatory.
[server]
ip = '0.0.0.0'
port = 8080
client_dir = '../client'
websocket = true
https section, if enabled the server listens both https and http. But with the
http protocol the server only understands GET requests (so not other verbs like
POST or websockets) and redirects to the https protocol.
The redirection address is taken from the value of fqdn.
If the fqdn value is missing the redirection is based on the request host
header. So:
* if you are have a domain-validated certificate, put in fqdn the hostname it
relates to,
* if you are using a self-signed certificate, leave it empty.
As exception, the server will serve via plain http the GET requests whose url
starts with the keep_http value, if non-empty. The default value is for let's
encrypt challenges.
The port value is not mandatory, if present the server will listen http
requests on the server.port and both http/https on the https.port. If absent
the server will listen only on server.port to both protocols.
Websockets are executed in wss if this section is enabled.
[https]
enabled = true
port = 8443
key = './selfsig_keys/key.pem'
cert = './selfsig_keys/cert.pem'
fqdn = ''
keep_http = '/.well-known/acme-challenge/'
auth section, if enabled the server protects the pages with basic auth.
If https is enabled, only the https expects the credentials, the http will just
redirect to https.
[auth]
enabled = false
realm = 'My site'
name = 'name'
password = 'password'