File tree Expand file tree Collapse file tree 7 files changed +40
-18
lines changed Expand file tree Collapse file tree 7 files changed +40
-18
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,16 @@ services:
67
67
context : docker/nginx/
68
68
image : tec-proxy:latest
69
69
container_name : tec-proxy
70
+ environment :
71
+ SERVER_NAME : encryptioncompendium.org
70
72
ports :
71
73
- " 80:80"
72
74
- " 443:443"
73
75
volumes :
74
76
# Shared volume with the gunicorn server that allows us to
75
77
# serve static files.
76
78
- staticfiles:/opt/services/tec-gunicorn/static:ro
77
- - letsencrypt:/etc/letsencrypt :rw
79
+ - letsencrypt:/tls :rw
78
80
depends_on :
79
81
- gunicorn
80
82
networks :
Original file line number Diff line number Diff line change @@ -10,3 +10,11 @@ RUN adduser -D -s /bin/false -G www-data www-data
10
10
11
11
# Create directory for caching
12
12
RUN mkdir -p /data/nginx/cache
13
+
14
+ RUN apk update \
15
+ && apk add --no-cache openssl \
16
+ && mkdir -p /tls/encryptioncompendium.org/
17
+
18
+ # Add a custom run script
19
+ COPY run.sh /run.sh
20
+ CMD [ "/run.sh" ]
Original file line number Diff line number Diff line change @@ -14,15 +14,11 @@ server {
14
14
client_max_body_size 4G;
15
15
server_name _;
16
16
17
- # ssl_certificate ${SSL_CERT} ;
18
- # ssl_certificate_key ${SSL_KEY} ;
17
+ ssl_certificate /tls/fullchain.pem ;
18
+ ssl_certificate_key /tls/privkey.pem ;
19
19
20
20
keepalive_timeout 70;
21
21
22
- # Absolute path to site
23
- root /var/www/public/;
24
- index index.html;
25
-
26
22
location / {
27
23
# everything is passed to Gunicorn
28
24
proxy_pass http://encryption_compendium_server;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ # Automatically redirect all http traffic to https
2
+ server {
3
+ listen 80 default_server;
4
+ listen [::]:80 default_server;
5
+
6
+ server_name _;
7
+
8
+ return 302 https://$host$request_uri;
9
+ }
Original file line number Diff line number Diff line change 30
30
ssl_prefer_server_ciphers on ;
31
31
32
32
# Logging
33
- access_log /var/log/nginx/access.log;
34
- error_log /var/log/nginx/error.log;
33
+ # access_log /var/log/nginx/access.log;
34
+ # error_log /var/log/nginx/error.log;
35
35
36
36
# Virtual host configs
37
37
include /etc/nginx/conf.d/*.conf;
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # Generate self-signed TLS certificates
4
+ if [ ! -f /tls/fullchain.pem ]
5
+ then
6
+ openssl req \
7
+ -x509 \
8
+ -newkey rsa:4096 \
9
+ -keyout /tls/privkey.pem \
10
+ -out /tls/fullchain.pem \
11
+ -days 30 \
12
+ -nodes \
13
+ -subj " /CN=${SERVER_NAME} "
14
+ fi
15
+
16
+ nginx -g ' daemon off;'
You can’t perform that action at this time.
0 commit comments