0
0
opnxng-deploy-playbook/templates/conf/nitter/nginx.conf.j2

57 lines
2.1 KiB
Django/Jinja

# {{ ansible_managed }}
events {
worker_connections 4096; ## Default: 1024
}
http {
limit_req_zone $binary_remote_addr zone=n.opnxng.com_sec:10m rate=1r/s;
limit_req_zone $binary_remote_addr zone=n.opnxng.com_min:10m rate=45r/m;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set_real_ip_from 192.168.0.0/16;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
location / {
resolver 127.0.0.11;
set $backend "nitter";
proxy_pass http://$backend:8080;
limit_req zone=n.opnxng.com_sec burst=3 nodelay;
limit_req zone=n.opnxng.com_min burst=4;
}
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "User-agent: *\nDisallow: /\n";
}
error_log /var/log/nginx/nitter_error.log notice;
location /pic/ { include shared_cache.conf; }
location /video/ { include shared_cache.conf; }
# If you are running nitter from docker then change `shared_static.conf` to `shared_cache.conf`
location /css/ { include shared_cache.conf; }
location /js/ { include shared_cache.conf; }
location /fonts/ { include shared_static.conf; }
location = /apple-touch-icon.png { include shared_static.conf; }
location = /apple-touch-icon-precomposed.png { include shared_static.conf; }
location = /android-chrome-192x192.png { include shared_static.conf; }
location = /favicon-32x32.png { include shared_static.conf; }
location = /favicon-16x16.png { include shared_static.conf; }
location = /favicon.ico { include shared_static.conf; }
location = /logo.png { include shared_static.conf; }
location = /site.webmanifest { include shared_static.conf; }
}
}