server { server_name www.nasph.ru; return 301 http://nasph.ru$request_uri; } server { server_name nasph.ru; root /var/www/node_projects/nasph.ru; index index.html index.htm index.nginx-debian.html; if ($http_referer ~* ^(http://|https://)ya\.ru/){ return 403; } if ($http_referer ~* yandex.ru) { return 403; } if ($http_user_agent ~* (.*aboundexbot.*|.*ahrefsbot.*|.*spbot.*|.*sitebot.*|.*seokicks-robot.*|.*semrushbot.*|.*searchmetricsbot.*|.*scoutjet.*|.*rogerbot.*|.*pagesinventory.*|.*nutch.*|.*ncbot.*|.*mj12bot.*|.*megaindex.*|.*meanpathbot.*|.*majestic-seo.*|.*majestic-12.*|.*lipperhey_spider.*|.*linkdexbot.*|.*ia_archiver.*|.*gigabot.*|.*ezooms.*|.*exabot.*|.*dsearch.*|.*dotbot.*|.*blexbot.*|.*blekkobo.*|.*backlinkcrawler.*|.*yandex.*|.*siteauditbot.*|.*yepbot.*|.*serpstatbot.*|.*linkpadbot.*)) { return 403; } if ($args) { return 301 /; } #Serve any static assets with NGINX location /.next/static { alias /var/www/node_projects/drupalogy.ru/.next/static; add_header Cache-Control "public, max-age=3600, immutable"; } location / { try_files $uri.html $uri/index.html # only serve html files from this dir @public @nextjs; add_header Cache-Control "public, max-age=3600"; } location ~ /\.well-known/acme-challenge/ { return 301 http://nasph.ru$request_uri; } location @public { add_header Cache-Control "public, max-age=3600"; } location @nextjs { # reverse proxy for next server proxy_pass http://localhost:3055; 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; } location ~ /.well-known { allow all; } }