-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
53 lines (53 loc) · 1.85 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
user nobody nogroup; pid /tmp/nginx.pid; error_log /var/log/nginx/error.log;
# Best set to 1 as long as CTFd is served up from the same host
worker_processes 1; events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # set to 'on' if nginx worker_processes > 1
use epoll; # a fast event mechanism for Linux 2.6+
}
http {
include mime.types;
# fallback in case we can't determine a type
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
# Set up a generous ssl session cache to reduce overhead
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# Disable delayed sending of small packets
tcp_nodelay on;
upstream ctfd_app {
#fail_timeout=0 always retry ctfd even if it failed
server ctfd:8000 fail_timeout=0;
}
server {
# if no Host match, close the connection to prevent host spoofing
listen 8000 default_server;
return 444;
}
server {
listen 8443 ssl deferred;
# You must either change this line or set the hostname of the server (e.g. through docker-compose.yml) for correct serving and ssl to be accepted
server_name $hostname;
# SSL settings: Ensure your certs have the correct host names
ssl_certificate /etc/ssl/fullchain.pem;
ssl_certificate_key /etc/ssl/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
# Set connections to timout in 5 seconds
keepalive_timeout 5;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://ctfd_app;
}
}
# Redirect clients from HTTP to HTTPS
server {
listen 8000;
server_name $hostname;
return 301 https://$server_name$request_uri;
}
}