-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf
119 lines (96 loc) · 4.31 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
worker_processes 8;
events {
worker_connections 4096;
}
http {
#global to all server blocks
#==========================================================================
# Set data/file types
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
log_subrequest on;
# Set proxy specifics and set variables (i.e., remote IP address)
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
proxy_max_temp_file_size 0;
client_max_body_size 1025m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 16 64k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
# Set SSL specifics
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ssl on;
ssl_session_timeout 5m;
ssl_protocols TLSv1; #required by SNI
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
server_tokens off;
# LUA specifics
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lua_need_request_body on;
# HTTPS server foo
#------------------------------------------------------------------------
server {
listen 443 ssl;
server_name foo.example.com;
access_log /var/log/nginx/foo.example.com_access.log;
error_log /var/log/nginx/foo.example.com_error.log;
ssl_certificate /usr/local/etc/nginx/ssl/foo.example.com.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/foo.example.com.key;
location / {
set $plex_auth_secret "Secret.Random.String.For.Making.Tokens";
set $plex_auth_server_ID "The.Plex.tv.machineIdentifier.For.The.Mapped.Server";
set $plex_auth_expires_after 3600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
access_by_lua_file /usr/local/etc/nginx/plex_auth.lua;
proxy_pass https://foo.example.local;
}
location = /_auth {
internal;
proxy_pass https://plex.tv/pms/servers;
proxy_pass_request_body off;
proxy_set_header Accept-Encoding "";
}
}
# HTTPS server bar
#------------------------------------------------------------------------
server {
listen 443 ssl;
server_name bar.example.com;
access_log /var/log/nginx/bar.example.com_access.log;
error_log /var/log/nginx/bar.example.com_error.log;
ssl_certificate /usr/local/etc/nginx/ssl/bar.example.com.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/bar.example.com.key;
location / {
set $plex_auth_secret "Another.Secret.Random.String.For.Making.Tokens";
set $plex_auth_server_ID "The.Plex.tv.machineIdentifier.For.The.Mapped.Server";
set $plex_auth_expires_after 3600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
access_by_lua_file /usr/local/etc/nginx/plex_auth.lua;
proxy_pass https://bar.example.local;
}
location = /_auth {
internal;
proxy_pass https://plex.tv/pms/servers;
proxy_pass_request_body off;
proxy_set_header Accept-Encoding "";
}
}