-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf.template
46 lines (35 loc) · 1.1 KB
/
nginx.conf.template
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
user nginx;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
sendfile on;
keepalive_timeout 65;
# Don't expose NGINX version
server_tokens off;
# Tell the browser to view unknown mime-types as plaintext,
default_type text/plain;
# Don't keep logs
access_log /dev/null;
error_log /dev/null;
server {
listen 80;
server_name ${SERVER_NAME};
location / {
# Check if CF-Connecting-IP exists and set X-Forwarded-For accordingly
set $real_ip $remote_addr;
if ($http_cf_connecting_ip) {
# Override if Cloudflare header is present
set $real_ip $http_cf_connecting_ip;
}
# Set headers for proxying
proxy_set_header X-Real-IP $real_ip;
proxy_set_header X-Forwarded-For $real_ip;
proxy_set_header Host $host;
proxy_set_header Connection $http_connection;
proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT};
}
}
}