main
km0 1 year ago
parent fac5b285b7
commit 5d0ac64ed9

@ -52,7 +52,7 @@ npm install
### Environmental variables
There are a couple of environmental variables to be set: one refers to the port where to mount the application, the other is related to the prefix to add to the application urls.
There are a couple of environmental variables to set: one refers to the port where to mount the application, the other is related to the prefix to add to the application urls.
```
nano .env
@ -62,7 +62,7 @@ Will create a new `.env` file where to add the values for this specific environm
In the case of the soupboat, for example:
```
PORT=3154
PORT=3000
PREFIX=/soupboat/drw/
```
@ -78,7 +78,9 @@ For example, will print the process currently using the port 3000. If nothing is
Read more about it here: [Check if port is in use Linux](https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/)
The prefix variable is a way to deal with the _hub.xpub.nl_ ecosystem. Here our base url is `hub.xpub.nl`. Notice that is missing the `/soupboat/drw/` part.
The deal of the prefix is to leave out from the code these part of the address, that otherwise should be repeated in every url and navigation element. This also make the code a bit more portable, meaning that you can test it locally and online without messing around with the urls in the code.
The deal of the prefix is to leave out from the code these parts of the address, that otherwise should be repeated in every url and navigation element of the app.
This also make the code a bit more portable, meaning that you can test it locally and online without messing around with the urls in the code.
The app is written in order to provide some default values if an `.env` file is not found, and that's why it works locally even without specifying any environmental variables.
@ -86,8 +88,6 @@ The app is written in order to provide some default values if an `.env` file is
To make it works behind a reverse-proxy open the NGINX configuration file
(it requires root privileges!)
```
sudo nano /etc/nginx/sites-available/default
```
@ -103,24 +103,24 @@ server {
root /var/www/html
# ADD THIS SECTION -------
# ADD THIS SECTION
location /drw/ {
proxy_pass http://localhost:3000/soupboat/drw/;
include proxy_params;
proxy_set_header Host $http_host; # 4
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
} # END OF SECTION -------
} # END OF SECTION
}
```
The lines that you should edit according your configurations are:
- `location /drw/`
The name of the location `/drw/` is up to you, and it's the address where the app will be served. In this case will be `hub.xpub.nl/soupboat/drw/`.
The name of the location _/drw/_ is up to you, and it's the address where the app will be served. In this case will be _hub.xpub.nl/soupboat/drw/_.
- `proxy_pass http://localhost:3000/soupboat/drw/;`
The very same name, as well as eventual prefixes, need to be specified in the line of `proxy_pass`.
The port, in this example set to `3000`, it's the port where Express is mounting the application. By default is 3000, but you can edit it according to the configurations of the express server.
The very same name, as well as eventual prefixes, need to be specified in the line of _proxy_pass_.
The port, in this example set to _3000_, it's the port where Express is mounting the application. By default is 3000, but you can edit it according to the configurations of the express server.
The three `proxy_set_header` Host, Upgrade and Connection are necessary to make the Websocket connection work.

Loading…
Cancel
Save