#228 use nginx as proxy

This commit is contained in:
Jan Prochazka 2022-02-26 09:54:14 +01:00
parent 6113547304
commit 462f985406
5 changed files with 57 additions and 2 deletions

View File

@ -3,8 +3,8 @@
version: "3"
services:
dbgate:
# build: docker
image: dbgate/dbgate:beta-alpine
build: docker
# image: dbgate/dbgate:beta-alpine
restart: always
ports:
- 3100:3000
@ -17,6 +17,12 @@ services:
environment:
WEB_ROOT: /dbgate
proxy:
# image: nginx
build: test/nginx
ports:
- 8082:80
# volumes:
# - /home/jena/test/chinook:/mnt/sqt
# environment:

View File

@ -55,6 +55,7 @@ function start() {
res.set({
'Cache-Control': 'no-cache',
'Content-Type': 'text/event-stream',
'X-Accel-Buffering': 'no',
Connection: 'keep-alive',
});
res.flushHeaders();

View File

@ -5,6 +5,7 @@ let init = '';
module.exports = {
setSseResponse(value) {
sseResponse = value;
setInterval(() => this.emit('ping'), 30 * 1000);
},
setElectronSender(value) {
electronSender = value;

3
test/nginx/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM nginx
COPY nginx.conf /etc/nginx/nginx.conf

44
test/nginx/nginx.conf Normal file
View File

@ -0,0 +1,44 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
# include /etc/nginx/conf.d/*.conf;
server {
# listen 80;
# return 302 https://dbgate.org;
location /dbgate {
proxy_pass http://dbgate:3000;
# proxy_http_version 1.1;
# proxy_set_header Connection "";
}
}
}