Browse Source

Add reverse proxy

pull/1/head
asyncnomi 3 years ago
parent
commit
57e853d16a
  1. 4
      README.md
  2. 2
      index.js
  3. 6
      reverse-proxy.conf

4
README.md

@ -9,6 +9,10 @@
* Install node: `nvm install 18.12.1 && nvm use 18.12.1` * Install node: `nvm install 18.12.1 && nvm use 18.12.1`
* Install pm2: `npm install pm2 -g` * Install pm2: `npm install pm2 -g`
* Install nginx: `sudo apt-get install nginx` * Install nginx: `sudo apt-get install nginx`
* Remove default virtual host: `sudo unlink /etc/nginx/sites-enabled/default`
* move conf: `sudo mv reverse-proxy.conf /etc/nginx/sites-available/`
* Enable site: `sudo ln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/reverse-proxy.conf`
* restart nginx: `systemctl restart nginx`
2. Installation: 2. Installation:

2
index.js

@ -351,7 +351,7 @@ function makeid(length) {
const start = async () => { const start = async () => {
try { try {
await fastify.listen({ port: 3000 , host: '0.0.0.0',}) await fastify.listen({ port: 3000 , host: '127.0.0.1',})
} catch (err) { } catch (err) {
fastify.log.error(err) fastify.log.error(err)
LDAP.close(function(err) { LDAP.close(function(err) {

6
reverse-proxy.conf

@ -0,0 +1,6 @@
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
Loading…
Cancel
Save