events { worker_connections 1024; } http { map $host $blocked_domain { include /etc/nginx/blacklist.conf; default 0; } server { listen 80; server_name ton.ski; charset utf-8; access_log off; error_log off; location /about/ { proxy_set_header Host tonxy.pro; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass https://tonxy.pro/about/; } location /access/ { proxy_set_header Host tonxy.pro; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass https://tonxy.pro/access/; } location = /non.png { root /home/ennucore/agorata/design; try_files /non.png =404; } location / { if ($blocked_domain) { rewrite ^ /blocked.html last; } proxy_set_header Host tonxy.pro; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_pass https://tonxy.pro/about/; #proxy_pass http://searching.ton.ski; proxy_pass http://localhost:5980; #proxy_http_version 1.1; # proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection 'upgrade'; # proxy_set_header Host $host; # proxy_cache_bypass $http_upgrade; #default_type text/html; } location = /blocked.html { root blacklist.html; # Замените на путь к вашим HTML-файлам } } server { listen 443 ssl; listen 80; server_name ~^(?.+)\.ton\.ski$; charset utf-8; #root /srv/http/tonxy.pro; ssl_certificate /etc/letsencrypt/live/ton.ski-0001/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/ton.ski-0001/privkey.pem; access_log off; error_log off; if ($scheme != "https") { return 301 https://$host$request_uri; } set $skip_cache 0; if ($http_cookie ~* "nginx_no_cache|PHPSESSID") { set $skip_cache 1; } if ($request_uri ~* "/ping|/metrics|/nginx_status|/admin|/login|/feed|sitemap(_index)?.xml") { set $skip_cache 1; } location / { subs_filter http://(\w*).ton http://$1.ton.ski ir; subs_filter_types text/css text/javascript application/json application/javascript; proxy_set_header Host "${subdomain}.ton"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Accept-Encoding ""; proxy_ignore_headers Expires; proxy_ignore_headers Cache-Control; proxy_set_header Cookie ""; proxy_pass http://in1.ton.org:8080; #proxy_cache tonxy; #proxy_cache_convert_head off; #proxy_cache_methods GET HEAD; #proxy_cache_valid 499 502 503 504 10s; #proxy_cache_valid any 10m; #proxy_cache_key $request_method$host$uri$is_args$args; proxy_no_cache $http_pragma $http_authorization $skip_cache; proxy_cache_bypass $http_pragma $http_authorization $skip_cache; add_header X-Proxy-Cache $upstream_cache_status; } } server { listen 80; server_name ~^(?.+)\.(?.+)\.ton$; resolver 8.8.8.8; location / { proxy_pass http://151.236.222.99:5170/page/$subdomain.$zone; } } }