mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-12 22:47:12 +03:00
refactored nginx configs
- handle CORS within nginx - remove allow-headers from CORS - add custom dynamic error pages - remove unused fastcgi - removed OPTIONS backend - remove previous custom errorDirective - moved proxy directives to appropiate file
This commit is contained in:
@@ -16,16 +16,15 @@ http {
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
include /etc/nginx/proxy.conf;
|
||||
include /etc/nginx/fastcgi.conf;
|
||||
## Custom MIME definition
|
||||
# error_map has to be at http level
|
||||
include /etc/nginx/error_map.conf;
|
||||
# Custom MIME definition
|
||||
types {
|
||||
text/csv csv;
|
||||
}
|
||||
# keepalive settings
|
||||
keepalive_requests 10;
|
||||
keepalive_timeout 5;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
access_log off;
|
||||
error_log /dev/null crit;
|
||||
|
||||
@@ -66,15 +65,11 @@ http {
|
||||
server 10.0.0.3:4441;
|
||||
#server 10.0.0.3:4442;
|
||||
}
|
||||
upstream backend_OPTIONS {
|
||||
server 10.0.0.3:4441;
|
||||
}
|
||||
upstream backend_db {
|
||||
server 10.0.0.4:4441;
|
||||
#server 10.0.0.3:4441;
|
||||
#server 10.0.0.4;
|
||||
}
|
||||
|
||||
upstream backend_db_dl {
|
||||
server 10.0.0.4;
|
||||
}
|
||||
@@ -86,26 +81,7 @@ http {
|
||||
server {
|
||||
server_name sponsor.ajay.app api.sponsor.ajay.app;
|
||||
|
||||
error_page 404 /404.html;
|
||||
#error_page 500 @myerrordirective_500;
|
||||
#error_page 502 @myerrordirective_502;
|
||||
#error_page 504 @myerrordirective_504;
|
||||
#location = /404 {
|
||||
# root /home/sbadmin/caddy/SponsorBlockSite/public-prod;
|
||||
# internal;
|
||||
#}
|
||||
|
||||
#proxy_send_timeout 120s;
|
||||
|
||||
#location @myerrordirective_500 {
|
||||
# return 400 "Internal Server Error";
|
||||
#}
|
||||
#location @myerrordirective_502 {
|
||||
# return 400 "Bad Gateway";
|
||||
#}
|
||||
#location @myerrordirective_504 {
|
||||
# return 400 "Gateway Timeout";
|
||||
#}
|
||||
include /etc/nginx/error.conf;
|
||||
|
||||
location /news {
|
||||
return 301 https://blog.ajay.app/sponsorblock;
|
||||
@@ -124,6 +100,7 @@ http {
|
||||
#access_log /etc/nginx/logs/requests.log no_ip buffer=64k;
|
||||
|
||||
location /api/skipSegments {
|
||||
include /etc/nginx/cors.conf
|
||||
#return 200 "[]";
|
||||
proxy_pass http://backend_$request_method;
|
||||
#proxy_cache CACHEZONE;
|
||||
@@ -134,31 +111,35 @@ http {
|
||||
if ($request_method = POST) {
|
||||
access_log /etc/nginx/logs/submissions.log user_agent buffer=64k;
|
||||
}
|
||||
|
||||
|
||||
#proxy_read_timeout 6s;
|
||||
#proxy_next_upstream error timeout http_500 http_502;
|
||||
}
|
||||
|
||||
location /api/getTopUsers {
|
||||
include /etc/nginx/cors.conf
|
||||
proxy_pass http://backend_GET;
|
||||
proxy_cache CACHEZONE;
|
||||
proxy_cache_valid 20m;
|
||||
}
|
||||
|
||||
location /api/getTotalStats {
|
||||
include /etc/nginx/cors.conf
|
||||
proxy_pass http://backend_GET;
|
||||
proxy_cache CACHEZONE;
|
||||
proxy_cache_valid 20m;
|
||||
#return 200 "";
|
||||
#return 204;
|
||||
}
|
||||
|
||||
location /api/getTopCategoryUsers {
|
||||
include /etc/nginx/cors.conf
|
||||
proxy_pass http://backend_GET;
|
||||
proxy_cache CACHEZONE;
|
||||
proxy_cache_valid 20m;
|
||||
}
|
||||
|
||||
location /api/getVideoSponsorTimes {
|
||||
include /etc/nginx/cors.conf
|
||||
proxy_pass http://backend_GET;
|
||||
}
|
||||
|
||||
@@ -174,10 +155,11 @@ http {
|
||||
#proxy_buffering off;
|
||||
|
||||
|
||||
proxy_pass http://backend_db;
|
||||
proxy_pass http://backend_db;
|
||||
#alias /home/sbadmin/sponsor/docker/database-export/;
|
||||
#return 307 https://rsync.sponsor.ajay.app$request_uri;
|
||||
}
|
||||
|
||||
location /database {
|
||||
proxy_pass http://backend_db;
|
||||
#return 200 "Disabled for load reasons";
|
||||
@@ -202,6 +184,7 @@ http {
|
||||
#}
|
||||
|
||||
location /api {
|
||||
include /etc/nginx/cors.conf
|
||||
proxy_pass http://backend_POST;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user