-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
145 lines (114 loc) · 5.84 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
server_names_hash_bucket_size 64;
gzip on;
## SSL Configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
### If you're using a SSL certificate, uncomment the following lines to force redirect all HTTP traffic to HTTPS.
# server {
# listen 80;
# server_name your.domain.com;
# rewrite ^(.*) https://$server_name$request_uri? permanent;
# }
server {
listen 80; ### HTTP default port
# listen 443 ssl; ### If you're using SSL certificate, you need to listen on port 443 and comment the listen 80 above.
# ssl_certificate certificates/cert.pem; ### Change to your certificate path
# ssl_certificate_key certificates/cert.key; ### Change to your certificate key path
server_name your.domain.com; ### Substitute your domain name here
location / { ### Simple page with the shortcuts for the others services
root html; ### using html folder in the nginx folder (Windows edition) Adapt to your needs
index index.html index.htm; ### Using index.html file inside html folder
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
### The next two locations are for download files directly with nginx, using nginx autoindex.
location /animes {
alias "D:\Animes";
autoindex on;
autoindex_localtime on;
autoindex_exact_size off;
}
location /movies {
alias "D:\Animes-Movies";
autoindex on;
autoindex_localtime on;
autoindex_exact_size off;
}
### The next location is for qBittorrent WebUI running on the same machine. If you're using on another machine change the localhost to the IP of the machine running qBittorrent.
location /qbit/ {
proxy_pass http://localhost:8080/;
proxy_http_version 1.1;
proxy_set_header Host 127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_cookie_path / "/; Secure";
proxy_redirect off;
}
### The next location is for Plex Media Server WebUI running on the same machine. If you're using on another machine change the localhost to the IP of the machine running Plex Media Server.
location /plex {
rewrite /plex(/.*) $1 break; ### This is to make sure the "/plex" part of the URL doesn't get fed to Plex's web server (it expects URLs to start at the root)
proxy_pass http://localhost:32400;
proxy_http_version 1.1;
proxy_set_header Accept-Encoding "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
### This section is added becuase Plex actually hardcores some paths in the DOM to the webroot! This means that the browser will try to load resources from /web/ instead of /plex/web, effectively breaking the UI. This section fixes that by rewriting the paths in the HTML before sending it to the client.
sub_filter '/web/' '/plex/web/';
sub_filter_types html; #### UPDATE: this was because after the plex update, it added SRI to js and css files, and it was giving a white screen. To solve it, i added only html files to be filter, so it stopped giving the errors and solved the issue!
sub_filter_once off;
}
### For Sonarr and Radarr to work, you need to go to Settings > General > URL Base and set it to /sonarr and /radarr respectively. This is to make sure the reverse proxy works correctly.
location /sonarr {
proxy_pass http://localhost:8989;
proxy_http_version 1.1;
proxy_set_header Host 127.0.0.1:8989;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_redirect off;
}
location /radarr {
proxy_pass http://localhost:7878;
proxy_http_version 1.1;
proxy_set_header Host 127.0.0.1:7878;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_redirect off;
}
}
}