Move websocket behind nginx, add nginx.conf, update README
This commit is contained in:
parent
83ddaee4d1
commit
d73ed0e706
@ -8,6 +8,7 @@ Mempool visualizer for the Bitcoin blockchain. Live demo: https://mempool.space/
|
||||
* Bitcoin (full node required, no pruning)
|
||||
* NodeJS (official stable LTS)
|
||||
* MariaDB (default config)
|
||||
* Nginx (use supplied nginx.conf)
|
||||
|
||||
## NodeJS setup
|
||||
|
||||
@ -133,9 +134,11 @@ Then in another terminal:
|
||||
|
||||
```
|
||||
cd ../frontend/
|
||||
npm run start
|
||||
npm run build
|
||||
```
|
||||
|
||||
Start nginx using the supplied nginx.conf and copy the resulting dist/ into /var/www/html
|
||||
|
||||
## Open Browser
|
||||
|
||||
```
|
||||
|
@ -6,7 +6,7 @@ import { Observable } from 'rxjs';
|
||||
import { MemPoolService } from './mem-pool.service';
|
||||
import { tap, retryWhen, delay } from 'rxjs/operators';
|
||||
|
||||
const WEB_SOCKET_URL = 'ws://' + document.location.hostname + ':8999';
|
||||
const WEB_SOCKET_URL = 'ws://' + document.location.hostname + '/ws';
|
||||
const API_BASE_URL = '/api/v1';
|
||||
|
||||
@Injectable({
|
||||
|
75
nginx.conf
Normal file
75
nginx.conf
Normal file
@ -0,0 +1,75 @@
|
||||
user www-data;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
gzip on;
|
||||
gzip_comp_level 5;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied any;
|
||||
gzip_vary on;
|
||||
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # text/html is always compressed by gzip module
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name mempool.space;
|
||||
|
||||
if ($host = mempool.space) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
|
||||
return 404; # managed by Certbot
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:443 ssl ipv6only=on; # managed by Certbot
|
||||
listen 443 ssl; # managed by Certbot
|
||||
ssl_certificate /etc/letsencrypt/live/mempool.space/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/mempool.space/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
|
||||
root /var/www/html;
|
||||
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
server_name mempool.space; # managed by Certbot
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8999/api;
|
||||
}
|
||||
|
||||
location /ws {
|
||||
proxy_pass http://127.0.0.1:8999/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user