openresty-config/http.d/inv.conf
2025-03-31 15:54:12 -03:00

112 lines
2.8 KiB
Text

map $host $invidious_backend {
default inv;
inv1.nadeko.net invidious-1;
inv2.nadeko.net invidious-2;
inv3.nadeko.net invidious-3;
inv4.nadeko.net invidious-4;
inv5.nadeko.net invidious-5;
}
# map $invidious_backend $cache_case {
# default "";
# inv $cookie_INVIDIOUS_SERVER_ID;
# invidious-* $invidious_backend;
# }
# CLEARNET TOR AND I2P
# (Tor and I2P listens on 4080, defined on configs/listen.conf)
server {
error_log /var/log/nginx/inv.nadeko.net.error.log;
server_name
inv.nadeko.net
~^inv([1-5])\.nadeko\.net$
inv.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd.onion ~^inv([1-5])\.nadekonw7plitnjuawu6ytjsl7jlglk2t6pyq6eftptmiv3dvqndwvyd\.onion$;
include configs/listen.conf;
include configs/robotsNone.conf;
include configs/asn-ban.conf;
include configs/manual-ip-ban.conf;
# MAINTENANCE MODE
# include configs/maintenance-mode.conf;
# The messed up invidious configuration
include http.d/locations/inv.conf;
if ($blocked_agent = 1) {
return 403 "
Hi! You got blocked by network security!!!
Nah, just kidding, your IP range is blocked from
accessing this server/service.
If you think this is an error, contact me at:
https://nadeko.net/contact
";
}
if ($ssl_cipher = "ECDHE-ECDSA-CHACHA20-POLY1305") {
return 444;
}
#
# if ($http_user_agent = "") {
# return 444;
# }
error_page 502 /502.html;
error_page 503 /503.html;
#rewrite_by_lua_file conf/lua/rewrite-invidious/init.lua;
location = /503.html {
content_by_lua_file conf/lua/503-invidious.lua;
}
location = /502.html {
content_by_lua_file conf/lua/502-invidious.lua;
}
# location = /switchbackend {
# content_by_lua_file conf/lua/switchbackend.lua;
# }
}
# CLEARNET FEED
server {
error_log /var/log/nginx/inv.nadeko.net.feed.error.log;
access_log /var/log/nginx/inv.nadeko.net.feed.access.log;
server_name feed-inv.nadeko.net;
include configs/listen.conf;
include configs/robotsNone.conf;
# The messed up invidious configuration
include http.d/locations/inv-feed.conf;
}
# INVIDIOUS COMPANION
server {
server_name inv-cl1-c.nadeko.net;
include configs/listen.conf;
include configs/robotsNone.conf;
location / {
proxy_pass http://invidious-companion-backend1;
include configs/proxy.conf;
}
}
server {
server_name inv-cl1.nadeko.net;
include configs/listen.conf;
include configs/robotsNone.conf;
location / {
limit_rate 4000k;
proxy_pass http://http3-ytproxy-backend1;
include configs/proxy.conf;
sendfile_max_chunk 512k;
tcp_nopush on;
aio threads=default;
aio_write on;
directio 16m;
proxy_hide_header Cache-Control;
add_header Cache-Control private always;
}
}