Skip to content

Commit 96dac88

Browse files
committed
proxy now works with ssl as wss:// or ws://
1 parent 0c438a1 commit 96dac88

File tree

3 files changed

+40
-89
lines changed

3 files changed

+40
-89
lines changed

packages/websockproxy/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
2121
RUN apt-get install -y nano && apt-get install -y nginx
2222

2323
COPY nginx.conf /etc/nginx
24-
COPY default /etc/nginx/sites-enabled
24+
#COPY default /etc/nginx/sites-enabled ## moved this block to nginx.conf
2525
#EXPOSE 80
2626

2727
CMD /opt/websockproxy/docker-startup.sh

packages/websockproxy/default

-14
This file was deleted.

packages/websockproxy/nginx.conf

+39-74
Original file line numberDiff line numberDiff line change
@@ -8,84 +8,49 @@ events {
88
# multi_accept on;
99
}
1010

11-
http {
12-
13-
##
14-
# Basic Settings
15-
##
16-
17-
sendfile on;
18-
tcp_nopush on;
19-
tcp_nodelay on;
20-
keepalive_timeout 65;
21-
types_hash_max_size 2048;
22-
# server_tokens off;
23-
24-
# server_names_hash_bucket_size 64;
25-
# server_name_in_redirect off;
26-
27-
include /etc/nginx/mime.types;
28-
default_type application/octet-stream;
29-
30-
##
31-
# SSL Settings
32-
##
33-
34-
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
35-
ssl_prefer_server_ciphers on;
36-
37-
##
38-
# Logging Settings
39-
##
40-
41-
#access_log /var/log/nginx/access.log;
42-
#error_log /var/log/nginx/error.log;
43-
44-
##
45-
# Gzip Settings
46-
##
11+
stream {
12+
#access_log /var/log/nginx/db.access.log;
13+
#error_log /var/log/nginx/db.error.log;
14+
#include /etc/nginx/sites-enabled/default;
4715

48-
gzip on;
16+
map $server_port $upstream {
17+
"~(\d)(\d\d\d)$" 10.5.$1.$2:5432;
18+
}
4919

50-
# gzip_vary on;
51-
# gzip_proxied any;
52-
# gzip_comp_level 6;
53-
# gzip_buffers 16 8k;
54-
# gzip_http_version 1.1;
55-
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
20+
server {
21+
listen 6001-6254 so_keepalive=on;
5622

57-
##
58-
# Virtual Host Configs
59-
##
23+
#allow <ip_address>;
24+
#deny all;
6025

61-
include /etc/nginx/conf.d/*.conf;
62-
#include /etc/nginx/sites-enabled/*;
26+
proxy_connect_timeout 60s;
27+
proxy_socket_keepalive on;
28+
proxy_pass $upstream;
29+
}
6330
}
6431

65-
66-
#mail {
67-
# # See sample authentication script at:
68-
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
69-
#
70-
# # auth_http localhost/auth.php;
71-
# # pop3_capabilities "TOP" "USER";
72-
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
73-
#
74-
# server {
75-
# listen localhost:110;
76-
# protocol pop3;
77-
# proxy on;
78-
# }
79-
#
80-
# server {
81-
# listen localhost:143;
82-
# protocol imap;
83-
# proxy on;
84-
# }
85-
#}
86-
stream {
87-
#access_log /var/log/nginx/db.access.log;
88-
#error_log /var/log/nginx/db.error.log;
89-
include /etc/nginx/sites-enabled/default;
32+
http {
33+
server {
34+
listen 443 http2 ssl;
35+
listen [::]:443 http2 ssl;
36+
37+
server_name proxy.azabab.com;
38+
ssl_certificate /root/fullchain.pem;
39+
ssl_certificate_key /root/privkey.pem;
40+
ssl_prefer_server_ciphers on;
41+
42+
location / {
43+
proxy_set_header Host $host;
44+
proxy_set_header X-Real-IP $remote_addr;
45+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
46+
proxy_set_header X-Forwarded-Proto $scheme;
47+
48+
proxy_pass http://localhost:80;
49+
proxy_read_timeout 90;
50+
51+
proxy_http_version 1.1;
52+
proxy_set_header Upgrade $http_upgrade;
53+
proxy_set_header Connection "upgrade";
54+
}
55+
}
9056
}
91-

0 commit comments

Comments
 (0)