Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###############################################################################################
- #
- # 15.10.2017 Config for Nginx >= 1.11.10 https://habrahabr.ru/post/282554/
- # Полный мануал настройки http://pastebin.com/v0VKjKXW
- #
- # v 1.3 fast server http://vk.cc/5VDdBb
- # Рабочий вариант, кеширование работает ( + кеширование в оперативную память )
- #===================support / вопросы, пожелания, замечания просьба слать сюда 2010-10 @ mail.ru ==============
- #
- #
- # Nginx port 80 -> Apache 81
- # - !ВАЖНО! прописать свой ip в секцию Upstream B <<<<<-!!!
- # - Динамическое определение доменов(поддоменов) и их директорий, и алиасов. (Настроено под VestaCP, если не угодно - поменяйте)
- # - Максимальная производительность и оптимизация
- # - Защита картинок и файлов отдайющихся nginx от хотлинкинга
- # - Защита от сторонних ботов, для снижения нагрузки
- # - SSl убран на apache2 , если надо сами настраивайте )
- #
- #Дополнительно: помещаем кэш nginx в ramdisk (tmpfs)
- #Сейчас у нас кэширование настроено, но кэш хранится на жестком диске, что не является хорошим решение. Оптимальнее будет смонтировать директорию с кэшем nginx в память.
- #Для этого откроем
- #nano/etc/fstab
- #и добавим туда:
- #tmpfs /var/lib/nginx/cache tmpfs nodev,nosuid,size=20M 0 0
- #Если в настройках nginx вы указали больший размер кэша, то параметр size необходимо изменить в соответствии с указанным размером кэша #(max_size), плюс небольшой запас.
- #Сразу смонтируем директорию в память:
- #sudo mount -a
- #service nginx restart; service apache2 restart; reboot;
- #Теперь при каждой загрузке системы, директория /var/lib/nginx/cache будет помещаться в память, что должно уменьшить время отдачи #страницы.
- #
- # Test VPS !KVM 1x1024RAM 20Gb SSD
- ## ab -r -n 10000 -c 10000 http://site.com/
- #Concurrency Level: 10000
- #Time taken for tests: 0.835 seconds
- #Complete requests: 10000
- #Failed requests: 0
- #Non-2xx responses: 10000
- #Total transferred: 3200000 bytes
- #HTML transferred: 1620000 bytes
- #Requests per second: 11976.08 [#/sec] (mean)
- #Time per request: 834.998 [ms] (mean)
- #Time per request: 0.083 [ms] (mean, across all concurrent requests)
- #Transfer rate: 3742.52 [Kbytes/sec] received
- #
- #Connection Times (ms)
- # min mean[+/-sd] median max
- #Total: 530 644 66.0 646 758
- ################################################################################################
- # Server globals
- user root; # так же как в apache2
- worker_processes auto;
- worker_cpu_affinity auto;
- timer_resolution 100ms; #Уменьшает разрешение таймеров времени в рабочих процессах, за счёт чего уменьшается число системных вызовов
- worker_rlimit_nofile 65192; #Изменяет ограничение на максимальное число открытых файлов (RLIMIT_NOFILE) для рабочих процессов
- worker_priority -5; #Выставляем более высокий приоритет процессу воркера
- error_log /var/log/nginx/error.log;
- pid /var/run/nginx.pid;
- # Worker config
- events {
- worker_connections 20048; # Максимальное количество подключений на процесс
- use epoll;
- accept_mutex off;
- }
- http {
- # Mime settings
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- # Main settings
- # не нужно включать sendfile, если не работаете с ram диском! Во-первых, вы теряете кэширование, что очень актуально для мелких файлов.
- #Во-вторых, для эффективной работы с дисками (hdd и ssd) есть aio/directio, которые не работают вместе с sendfile.
- sendfile off;
- sendfile_max_chunk 512k;
- tcp_nopush on;
- tcp_nodelay on;
- # Таймаут при чтении тела запроса клиента
- client_body_timeout 5;
- # Таймаут при чтении заголовка запроса клиента
- client_header_timeout 5;
- #Таймаут соединения позволяют избежать необходимости повторного создания соединения между клиентом и сервером.
- keepalive_timeout 3 5;
- # Максимальное количество keepalive запросов от одного клиента
- keepalive_requests 100;
- # Если клиент прекратит чтение ответа, Nginx подождет 1 секунду и сбросит соединение
- send_timeout 1;
- # Максимальный размер буфера для хранения тела запроса клиента
- client_body_buffer_size 10K;
- # Максимальный размер буфера для хранения заголовков запроса клиента
- client_header_buffer_size 5k;
- # Максимальный размер тела запроса клиента, прописанный в поле Content-Length заголовка.
- # Если сервер должен поддерживать загрузку файлов, это значение необходимо увеличить
- client_max_body_size 8m;
- # Количество и размер буферов для чтения большого заголовка запроса клиента
- large_client_header_buffers 2 5k;
- reset_timedout_connection on;
- server_tokens off;
- server_name_in_redirect off;
- server_names_hash_max_size 512;
- server_names_hash_bucket_size 512;
- # Proxy settings
- proxy_redirect off;
- proxy_connect_timeout 300;
- proxy_send_timeout 300;
- proxy_read_timeout 300;
- proxy_buffering on;
- proxy_buffers 8 2m;
- proxy_buffer_size 10m;
- proxy_busy_buffers_size 10m;
- # Cache https://syrog.ru/?p=314
- proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=cache:10m inactive=10m max_size=15m; #inactive Время хранения данных с последнего обращения
- proxy_temp_path /var/lib/nginx/proxy 1 2;
- proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
- proxy_hide_header "Set-Cookie"; # Гарантируем, что разные пользователи не получат одну и ту же сессионную Cookie.
- proxy_ignore_headers Expires Cache-Control;
- proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
- proxy_cache_bypass $cookie_session;
- proxy_no_cache $cookie_session;
- proxy_cache_valid 200 301 302 304 60m; #Время хранения данных в кеше 60 мин
- proxy_cache_valid 404 1m;
- # Настройки GZIP
- # http://nginx.org/ru/docs/http/ngx_http_gzip_module.html
- gzip on;
- gzip_static on;
- gzip_min_length 1024;
- gzip_buffers 64 8k;
- gzip_http_version 1.1;
- # Разрешает или запрещает сжатие ответа методом gzip для проксированных запросов в зависимости от запроса и ответа.
- gzip_proxied expired no-cache no-store private auth;
- # Разрешает сжатие ответа методом gzip для указанных MIME-типов в дополнение к text/html, который сжимается всегда.
- gzip_types text/plain text/css application/x-javascript application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml application/x-font-ttf font/opentype;
- # Запрещаем сжатие gzip для IE6. Специальная маска “msie6” (0.7.12) соответствует рег. выражению “MSIE [4-6]\.”, но работает быстрее. Начиная с версии 0.8.11, из этой маски исключается “MSIE 6.0; ... SV1”.
- gzip_disable "msie6";
- # Уровень gzip-компрессии.
- gzip_comp_level 7;
- gzip_proxied any;
- upstream A {
- server 127.0.0.1:81;
- }
- # Указать свой ip:81;
- upstream B {
- server Указать свой ip:81;
- }
- server {
- if ($request_method !~ ^(GET|HEAD|POST)$ ) {
- return 444;
- }
- #выставляем принудительно кодировку всех документов
- charset utf-8;
- listen 80 reuseport; # Слушаем 80 порт
- #Редирект с www на без www
- if ($http_host ~* "^www\.(.+)\.(.+)$"){ #Запоминаем хост без www из предыдущего выражения в переменной $nowww
- set $nowww $1.$2;
- #Делаем 301 редирект (permanent) .В $request_uri - адрес без хоста со всеми GET параметрами. После $request_uri добавляем '?' чтобы GET параметры не добавились дважды (по умолчанию)
- rewrite ^ http://$nowww$request_uri? permanent; }
- #Динамическое определение доменов и поддоменов
- #!Путь до папки с сайтом как в Vesta СP /home/admin/web/domen.ru/public_html/
- #Если нужные другие пути, они редактируются в строка помеченных #1
- set $basepath "/home/admin/web"; #1
- set $domain $host;
- if ($domain ~ "^(.[^.]*)$") {
- set $domain $1;
- set $rootpath "${domain}/public_html/"; #1
- set $servername "${domain}";
- }
- if ($domain ~ "^(.*)\.(.[^.]*)$") {
- set $subdomain $1;
- set $domain $2;
- set $rootpath "${subdomain}.${domain}/public_html/"; #1
- set $servername "${subdomain}.${domain}";
- }
- #Отключена ошибка 404 при отсутствии директории для работы алисов доменов и адресов вида ip
- #if (!-d $basepath/$rootpath) { return 404; }
- server_name $servername;
- #
- index index.php index.html index.htm;
- location / {
- # Все POST запросы отправляем на бекенд
- if ($request_method = POST) {
- proxy_pass http://A; break;
- }
- proxy_cache cache;
- location ~* ^.+\.(bmp|jpg|jpeg|gif|png|svg|js|css|html|htm|ico|txt|pdf|pptx?|docx?|xlsx?|rtf|xpi|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
- expires 7d;
- root $basepath/$rootpath/; # Директория поиска файлов
- #Защита от хотлинкинга , указанных поисковых сайтов и соцсетей
- #Хитрая проверка на свой сайт, ввиду того что динамика и сайты у нас разные
- #Спасибо автору Maxim Dounin http://nginx.org/en/donation.html
- set $temp "$host:$http_referer";
- if ($temp ~* "^(.*):https?://\1") {
- set $invalid_referer "0";
- }
- #Разрешено поисковым сайтам и соцсетям отображать у себя картинки и прочие файлы
- valid_referers none blocked server_names ~(duckduckgo|yandex|google|yahoo|bing|ok|twitter|vk|facebook|subscribe|feedburner|mail|rambler|nigma|ask|qip);
- if ($invalid_referer) {
- return 403;
- #сюда можно засунуть вместо retunr 403 свою картинку
- #rewrite ^(.*)$ http://blogsisadmina.ru/wp-content/uploads/2015/11/26.jpg redirect;
- }
- #
- error_page 404 502 503 504 = @fallback;
- try_files $uri @fallback;
- log_not_found off;
- }
- proxy_pass http://A;
- proxy_redirect http://A/ /;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- #Повторный запрос при ошибке
- error_page 404 502 503 504 = @fallback;
- try_files $uri @fallback;
- aio threads;
- log_not_found off;
- }
- location @fallback {
- proxy_pass http://B;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- log_not_found off;
- }
- # Блокируем менеджеры загрузки и некоторые типы ботов (update 15.10.2017)
- if ($http_user_agent ~ "8484\ Boston\ Project"){ return 403; } if ($http_user_agent ~ "Accelerator"){ return 403; } if ($http_user_agent ~ "AESOP"){ return 403; } if ($http_user_agent ~ "Ahrefs"){ return 403; } if ($http_user_agent ~ "AhrefsBot"){ return 403; } if ($http_user_agent ~ "Alexibot"){ return 403; } if ($http_user_agent ~ "almaden"){ return 403; } if ($http_user_agent ~ "Anarchie"){ return 403; } if ($http_user_agent ~ "Anonymouse.org"){ return 403; } if ($http_user_agent ~ "Ants"){ return 403; } if ($http_user_agent ~ "ApacheBench"){ return 403; } if ($http_user_agent ~ "Aport"){ return 403; } if ($http_user_agent ~ "AppEngine"){ return 403; } if ($http_user_agent ~ "Applebot"){ return 403; } if ($http_user_agent ~ "Aqua_Products"){ return 403; } if ($http_user_agent ~ "archive"){ return 403; } if ($http_user_agent ~ "Ask\ Jeeves"){ return 403; } if ($http_user_agent ~ "ASPSeek"){ return 403; } if ($http_user_agent ~ "asterias"){ return 403; } if ($http_user_agent ~ "Atomic_Email_Hunter"){ return 403; } if ($http_user_agent ~ "atSpider"){ return 403; } if ($http_user_agent ~ "attach"){ return 403; } if ($http_user_agent ~ "autoemailspider"){ return 403; } if ($http_user_agent ~ "b2w"){ return 403; } if ($http_user_agent ~ "BackDoorBot"){ return 403; } if ($http_user_agent ~ "BackWeb"){ return 403; } if ($http_user_agent ~ "BaiduBot"){ return 403; } if ($http_user_agent ~ "Baiduspider"){ return 403; } if ($http_user_agent ~ "bandit"){ return 403; } if ($http_user_agent ~ "Bandit"){ return 403; } if ($http_user_agent ~ "BatchFTP"){ return 403; } if ($http_user_agent ~ "Bigfoot"){ return 403; } if ($http_user_agent ~ "Birubot"){ return 403; } if ($http_user_agent ~ "Black\ Hole"){ return 403; } if ($http_user_agent ~ "BlackWidow"){ return 403; } if ($http_user_agent ~ "BLEXBot"){ return 403; }
- if ($http_user_agent ~ "BlowFish"){ return 403; } if ($http_user_agent ~ "Bookmark\ search\ tool"){ return 403; } if ($http_user_agent ~ "BotALot"){ return 403; } if ($http_user_agent ~ "bsalsa"){ return 403; } if ($http_user_agent ~ "Buddy"){ return 403; } if ($http_user_agent ~ "BuiltBotTough"){ return 403; } if ($http_user_agent ~ "BullsEye"){ return 403; } if ($http_user_agent ~ "bumblebee"){ return 403; } if ($http_user_agent ~ "BunnySlippers"){ return 403; } if ($http_user_agent ~ "Butterfly"){ return 403; } if ($http_user_agent ~ "Buzzbot"){ return 403; } if ($http_user_agent ~ "BuzzSumo"){ return 403; } if ($http_user_agent ~ "bwh3_user_agent"){ return 403; } if ($http_user_agent ~ "CamontSpider"){ return 403; } if ($http_user_agent ~ "CCBot"){ return 403; } if ($http_user_agent ~ "Cegbfeieh"){ return 403; } if ($http_user_agent ~ "CheeseBot"){ return 403; } if ($http_user_agent ~ "CherryPicker"){ return 403; } if ($http_user_agent ~ "China"){ return 403; } if ($http_user_agent ~ "ChinaClaw"){ return 403; } if ($http_user_agent ~ "CICC"){ return 403; } if ($http_user_agent ~ "clsHTTP"){ return 403; } if ($http_user_agent ~ "coccoc"){ return 403; } if ($http_user_agent ~ "Collector"){ return 403; } if ($http_user_agent ~ "CommentReader"){ return 403; } if ($http_user_agent ~ "ContactBot"){ return 403; } if ($http_user_agent ~ "ContentSmartz"){ return 403; } if ($http_user_agent ~ "Copernic"){ return 403; } if ($http_user_agent ~ "Copier"){ return 403; } if ($http_user_agent ~ "CopyRightCheck"){ return 403; } if ($http_user_agent ~ "cosmos"){ return 403; } if ($http_user_agent ~ "crazy"){ return 403; } if ($http_user_agent ~ "Crescent"){ return 403; } if ($http_user_agent ~ "curl"){ return 403; } if ($http_user_agent ~ "Curl"){ return 403; } if ($http_user_agent ~ "Custo"){ return 403; } if ($http_user_agent ~ "DataCha0s"){ return 403; }
- if ($http_user_agent ~ "dataminr"){ return 403; } if ($http_user_agent ~ "DBrowse"){ return 403; } if ($http_user_agent ~ "Demo\ Bot"){ return 403; } if ($http_user_agent ~ "DeuSu"){ return 403; } if ($http_user_agent ~ "Digincore"){ return 403; } if ($http_user_agent ~ "DIIbot"){ return 403; } if ($http_user_agent ~ "DISCo"){ return 403; } if ($http_user_agent ~ "discobot"){ return 403; } if ($http_user_agent ~ "Dispatch"){ return 403; } if ($http_user_agent ~ "dit"){ return 403; } if ($http_user_agent ~ "DittoSpyder"){ return 403; } if ($http_user_agent ~ "Dolphin"){ return 403; } if ($http_user_agent ~ "DomainSigma"){ return 403; } if ($http_user_agent ~ "DomainTools"){ return 403; } if ($http_user_agent ~ "DotBot"){ return 403; } if ($http_user_agent ~ "Download\ Demon"){ return 403; } if ($http_user_agent ~ "Download\ Devil"){ return 403; } if ($http_user_agent ~ "Download\ Wonder"){ return 403; } if ($http_user_agent ~ "Downloader"){ return 403; } if ($http_user_agent ~ "dragonfly"){ return 403; } if ($http_user_agent ~ "Drip"){ return 403; } if ($http_user_agent ~ "DSurf15"){ return 403; } if ($http_user_agent ~ "DuckDuckGo"){ return 403; } if ($http_user_agent ~ "EasyDL"){ return 403; } if ($http_user_agent ~ "ebingbong"){ return 403; } if ($http_user_agent ~ "EBrowse"){ return 403; } if ($http_user_agent ~ "eCatch"){ return 403; } if ($http_user_agent ~ "Educate\ Search\ VxB"){ return 403; } if ($http_user_agent ~ "EirGrabber"){ return 403; } if ($http_user_agent ~ "email"){ return 403; } if ($http_user_agent ~ "EmailCollector"){ return 403; } if ($http_user_agent ~ "EmailSiphon"){ return 403; } if ($http_user_agent ~ "EmailSpider"){ return 403; } if ($http_user_agent ~ "EmailWolf"){ return 403; } if ($http_user_agent ~ "Embedly"){ return 403; } if ($http_user_agent ~ "EroCrawler"){ return 403; } if ($http_user_agent ~ "ESurf15"){ return 403; }
- if ($http_user_agent ~ "Exabot"){ return 403; } if ($http_user_agent ~ "Express\ WebPictures"){ return 403; } if ($http_user_agent ~ "Extractor"){ return 403; } if ($http_user_agent ~ "EyeNetIE"){ return 403; } if ($http_user_agent ~ "Ezooms"){ return 403; } if ($http_user_agent ~ "facebookexternalhit"){ return 403; } if ($http_user_agent ~ "FairAd\ Client"){ return 403; } if ($http_user_agent ~ "FairShare"){ return 403; } if ($http_user_agent ~ "Faraday"){ return 403; } if ($http_user_agent ~ "Favicon"){ return 403; } if ($http_user_agent ~ "FeedFetcher"){ return 403; } if ($http_user_agent ~ "FileHound"){ return 403; } if ($http_user_agent ~ "filterdb"){ return 403; } if ($http_user_agent ~ "Flaming\ AttackBot"){ return 403; } if ($http_user_agent ~ "FlashGet"){ return 403; } if ($http_user_agent ~ "FlaxCrawler"){ return 403; } if ($http_user_agent ~ "Flexum"){ return 403; } if ($http_user_agent ~ "FlightDeckReportsBot"){ return 403; } if ($http_user_agent ~ "FlipboardProxy"){ return 403; } if ($http_user_agent ~ "flunky"){ return 403; } if ($http_user_agent ~ "Foobot"){ return 403; } if ($http_user_agent ~ "Franklin\ Locator"){ return 403; } if ($http_user_agent ~ "FrontPage"){ return 403; } if ($http_user_agent ~ "FSurf15"){ return 403; } if ($http_user_agent ~ "Full\ Web\ Bot"){ return 403; } if ($http_user_agent ~ "FyberSpider"){ return 403; } if ($http_user_agent ~ "Gaisbot"){ return 403; } if ($http_user_agent ~ "getintent"){ return 403; } if ($http_user_agent ~ "getprismatic"){ return 403; } if ($http_user_agent ~ "GetRight"){ return 403; } if ($http_user_agent ~ "Gets"){ return 403; } if ($http_user_agent ~ "GetSmart"){ return 403; } if ($http_user_agent ~ "GetWeb!"){ return 403; } if ($http_user_agent ~ "gigabaz"){ return 403; } if ($http_user_agent ~ "Gigabot"){ return 403; } if ($http_user_agent ~ "Go 1.1 package"){ return 403; }
- if ($http_user_agent ~ "Go!Zilla"){ return 403; } if ($http_user_agent ~ "Go-Ahead-Got-It"){ return 403; } if ($http_user_agent ~ "Go-http-client"){ return 403; } if ($http_user_agent ~ "gold crawler"){ return 403; } if ($http_user_agent ~ "gold\ crawler"){ return 403; } if ($http_user_agent ~ "gotit"){ return 403; } if ($http_user_agent ~ "GoZilla"){ return 403; } if ($http_user_agent ~ "Grabber"){ return 403; } if ($http_user_agent ~ "GrabNet"){ return 403; } if ($http_user_agent ~ "GrabSite"){ return 403; } if ($http_user_agent ~ "Grafula"){ return 403; } if ($http_user_agent ~ "GrapeshotCrawler"){ return 403; } if ($http_user_agent ~ "grub"){ return 403; } if ($http_user_agent ~ "grub-client"){ return 403; } if ($http_user_agent ~ "gsa-crawler"){ return 403; } if ($http_user_agent ~ "Guestbook\ Auto\ Submitter"){ return 403; } if ($http_user_agent ~ "Gulliver"){ return 403; } if ($http_user_agent ~ "Harvest"){ return 403; } if ($http_user_agent ~ "help.jp"){ return 403; } if ($http_user_agent ~ "hloader"){ return 403; } if ($http_user_agent ~ "HMView"){ return 403; } if ($http_user_agent ~ "HTMLParser"){ return 403; } if ($http_user_agent ~ "httpdown"){ return 403; } if ($http_user_agent ~ "httplib"){ return 403; } if ($http_user_agent ~ "httrack"){ return 403; } if ($http_user_agent ~ "HTTrack"){ return 403; } if ($http_user_agent ~ "humanlinks"){ return 403; } if ($http_user_agent ~ "hybrid"){ return 403; } if ($http_user_agent ~ "ia_archiver"){ return 403; } if ($http_user_agent ~ "IBrowse"){ return 403; } if ($http_user_agent ~ "IlseBot"){ return 403; } if ($http_user_agent ~ "Image\ Stripper"){ return 403; } if ($http_user_agent ~ "Image\ Sucker"){ return 403; } if ($http_user_agent ~ "Industry\ Program"){ return 403; } if ($http_user_agent ~ "Indy Library"){ return 403; } if ($http_user_agent ~ "Indy\ Library"){ return 403; }
- if ($http_user_agent ~ "InfoNaviRobot"){ return 403; } if ($http_user_agent ~ "InfoSeek"){ return 403; } if ($http_user_agent ~ "InfoTekies"){ return 403; } if ($http_user_agent ~ "inktomi"){ return 403; } if ($http_user_agent ~ "Intelliseek"){ return 403; } if ($http_user_agent ~ "InterGET"){ return 403; } if ($http_user_agent ~ "Internet\ Ninja"){ return 403; } if ($http_user_agent ~ "InternetLinkagent"){ return 403; } if ($http_user_agent ~ "InternetSeer"){ return 403; } if ($http_user_agent ~ "Iria"){ return 403; } if ($http_user_agent ~ "Iron33"){ return 403; } if ($http_user_agent ~ "ISC\ Systems"){ return 403; } if ($http_user_agent ~ "IUPUI\ Research\ Bot"){ return 403; } if ($http_user_agent ~ "Jakarta"){ return 403; } if ($http_user_agent ~ "Java"){ return 403; } if ($http_user_agent ~ "JBH\ agent"){ return 403; } if ($http_user_agent ~ "JennyBot"){ return 403; } if ($http_user_agent ~ "jetcar"){ return 403; } if ($http_user_agent ~ "JetCar"){ return 403; } if ($http_user_agent ~ "JOC"){ return 403; } if ($http_user_agent ~ "JS-Kit"){ return 403; } if ($http_user_agent ~ "JustView"){ return 403; } if ($http_user_agent ~ "Jyxobot"){ return 403; } if ($http_user_agent ~ "Kenjin\ Spider"){ return 403; } if ($http_user_agent ~ "Keyword\ Density"){ return 403; } if ($http_user_agent ~ "km.ru"){ return 403; } if ($http_user_agent ~ "kmSearchBot"){ return 403; } if ($http_user_agent ~ "Kraken"){ return 403; } if ($http_user_agent ~ "larbin"){ return 403; } if ($http_user_agent ~ "Laserlikebot"){ return 403; } if ($http_user_agent ~ "leech"){ return 403; } if ($http_user_agent ~ "LeechFTP"){ return 403; } if ($http_user_agent ~ "Leikibot"){ return 403; } if ($http_user_agent ~ "LetsCrawl.com"){ return 403; } if ($http_user_agent ~ "LexiBot"){ return 403; } if ($http_user_agent ~ "lftp"){ return 403; } if ($http_user_agent ~ "libWeb"){ return 403; }
- if ($http_user_agent ~ "libwww"){ return 403; } if ($http_user_agent ~ "Lightspeedsystems"){ return 403; } if ($http_user_agent ~ "likse"){ return 403; } if ($http_user_agent ~ "Lincoln\ State\ Web\ Browser"){ return 403; } if ($http_user_agent ~ "Linguee"){ return 403; } if ($http_user_agent ~ "LinkBot"){ return 403; } if ($http_user_agent ~ "linkdexbot"){ return 403; } if ($http_user_agent ~ "LinkExchanger"){ return 403; } if ($http_user_agent ~ "LinkextractorPro"){ return 403; } if ($http_user_agent ~ "linkfluence"){ return 403; } if ($http_user_agent ~ "LinkpadBot"){ return 403; } if ($http_user_agent ~ "LinkScan"){ return 403; } if ($http_user_agent ~ "LinkSleuth"){ return 403; } if ($http_user_agent ~ "LinkWalker"){ return 403; } if ($http_user_agent ~ "liveinternet"){ return 403; } if ($http_user_agent ~ "LivelapBot"){ return 403; } if ($http_user_agent ~ "LMQueueBot"){ return 403; } if ($http_user_agent ~ "LNSpiderguy"){ return 403; } if ($http_user_agent ~ "LoadImpactPageAnalyzer"){ return 403; } if ($http_user_agent ~ "looksmart"){ return 403; } if ($http_user_agent ~ "ltx71"){ return 403; } if ($http_user_agent ~ "LWP"){ return 403; } if ($http_user_agent ~ "lwp-trivial"){ return 403; } if ($http_user_agent ~ "Mac\ Finder"){ return 403; } if ($http_user_agent ~ "Magnet"){ return 403; } if ($http_user_agent ~ "Mag-Net"){ return 403; } if ($http_user_agent ~ "majestic"){ return 403; } if ($http_user_agent ~ "MarkWatch"){ return 403; }
- if ($http_user_agent ~ "Mass\ Downloader"){ return 403; } if ($http_user_agent ~ "masscan"){ return 403; } if ($http_user_agent ~ "Mata\ Hari"){ return 403; } if ($http_user_agent ~ "meanpathbot"){ return 403; } if ($http_user_agent ~ "Mediatoolkitbot"){ return 403; } if ($http_user_agent ~ "MegaIndex"){ return 403; } if ($http_user_agent ~ "Memo"){ return 403; } if ($http_user_agent ~ "MetaURI"){ return 403; } if ($http_user_agent ~ "MFC\ Foundation\ Class\ Library"){ return 403; } if ($http_user_agent ~ "mfibot"){ return 403; } if ($http_user_agent ~ "Microsoft\ URL\ Control"){ return 403; } if ($http_user_agent ~ "MIDown\ tool"){ return 403; } if ($http_user_agent ~ "MIIxpc"){ return 403; } if ($http_user_agent ~ "Mirror"){ return 403; } if ($http_user_agent ~ "Missauga\ Loca"){ return 403; } if ($http_user_agent ~ "Missouri\ College\ Browse"){ return 403; } if ($http_user_agent ~ "Mister\ PiX"){ return 403; } if ($http_user_agent ~ "Mizzu\ Labs"){ return 403; } if ($http_user_agent ~ "MJ12bot"){ return 403; } if ($http_user_agent ~ "MLBot"){ return 403; } if ($http_user_agent ~ "Mo\ College"){ return 403; } if ($http_user_agent ~ "moget"){ return 403; } if ($http_user_agent ~ "Mozilla\ Indy"){ return 403; } if ($http_user_agent ~ "Mozilla\ MSIECrawler"){ return 403; } if ($http_user_agent ~ "Mozilla\ NEWT"){ return 403; } if ($http_user_agent ~ "MS\ FrontPage"){ return 403; } if ($http_user_agent ~ "MSFrontPage"){ return 403; } if ($http_user_agent ~ "MSIECrawler"){ return 403; } if ($http_user_agent ~ "MSProxy"){ return 403; } if ($http_user_agent ~ "musobot"){ return 403; } if ($http_user_agent ~ "MVAClient"){ return 403; } if ($http_user_agent ~ "NameOfAgent"){ return 403; } if ($http_user_agent ~ "NAMEPROTECT"){ return 403; } if ($http_user_agent ~ "NASA\ Search"){ return 403; } if ($http_user_agent ~ "Navroad"){ return 403; }
- if ($http_user_agent ~ "NearSite"){ return 403; } if ($http_user_agent ~ "NerdByNature"){ return 403; } if ($http_user_agent ~ "Net\ Vampire"){ return 403; } if ($http_user_agent ~ "NetAnts"){ return 403; } if ($http_user_agent ~ "Netcraft"){ return 403; } if ($http_user_agent ~ "NetMechanic"){ return 403; } if ($http_user_agent ~ "NetReaper"){ return 403; } if ($http_user_agent ~ "NetSeer"){ return 403; } if ($http_user_agent ~ "NetSpider"){ return 403; } if ($http_user_agent ~ "NetZIP"){ return 403; } if ($http_user_agent ~ "NewShareCounts"){ return 403; } if ($http_user_agent ~ "NextGenSearchBot"){ return 403; } if ($http_user_agent ~ "NICErsPRO"){ return 403; } if ($http_user_agent ~ "NimbleCrawler"){ return 403; } if ($http_user_agent ~ "NING"){ return 403; } if ($http_user_agent ~ "Ninja"){ return 403; } if ($http_user_agent ~ "NjuiceBot"){ return 403; } if ($http_user_agent ~ "NPbot"){ return 403; } if ($http_user_agent ~ "Nsauditor"){ return 403; } if ($http_user_agent ~ "Nutch"){ return 403; } if ($http_user_agent ~ "Nuzzel"){ return 403; } if ($http_user_agent ~ "Octopus"){ return 403; } if ($http_user_agent ~ "Offline"){ return 403; } if ($http_user_agent ~ "Offline\ Explorer"){ return 403; } if ($http_user_agent ~ "Offline\ Navigator"){ return 403; } if ($http_user_agent ~ "omgili"){ return 403; } if ($http_user_agent ~ "omgilibot"){ return 403; } if ($http_user_agent ~ "OmniExplorer_Bot"){ return 403; } if ($http_user_agent ~ "Openbot"){ return 403; } if ($http_user_agent ~ "Openfind"){ return 403; } if ($http_user_agent ~ "OpenHoseBot"){ return 403; } if ($http_user_agent ~ "openstat"){ return 403; } if ($http_user_agent ~ "openstat.ru"){ return 403; } if ($http_user_agent ~ "OptimizationCrawler"){ return 403; } if ($http_user_agent ~ "Oracle\ Ultra\ Search"){ return 403; } if ($http_user_agent ~ "OutfoxBot"){ return 403; }
- if ($http_user_agent ~ "PageGrabber"){ return 403; } if ($http_user_agent ~ "PageSaver"){ return 403; } if ($http_user_agent ~ "Panopta"){ return 403; } if ($http_user_agent ~ "Papa\ Foto"){ return 403; } if ($http_user_agent ~ "PaperLiBot"){ return 403; } if ($http_user_agent ~ "pavuk"){ return 403; } if ($http_user_agent ~ "PBrowse"){ return 403; } if ($http_user_agent ~ "pcBrowser"){ return 403; } if ($http_user_agent ~ "PerMan"){ return 403; } if ($http_user_agent ~ "PEval"){ return 403; } if ($http_user_agent ~ "pflab"){ return 403; } if ($http_user_agent ~ "PHP"){ return 403; } if ($http_user_agent ~ "PHP/"){ return 403; } if ($http_user_agent ~ "Ping"){ return 403; } if ($http_user_agent ~ "PingALink"){ return 403; } if ($http_user_agent ~ "Pingdom"){ return 403; } if ($http_user_agent ~ "pirst"){ return 403; } if ($http_user_agent ~ "Pita"){ return 403; } if ($http_user_agent ~ "Pockey"){ return 403; } if ($http_user_agent ~ "Poirot"){ return 403; } if ($http_user_agent ~ "Port\ Huron\ Labs"){ return 403; } if ($http_user_agent ~ "postano"){ return 403; } if ($http_user_agent ~ "PostRank"){ return 403; } if ($http_user_agent ~ "PrivacyAware"){ return 403; } if ($http_user_agent ~ "Production\ Bot"){ return 403; } if ($http_user_agent ~ "Program\ Shareware"){ return 403; } if ($http_user_agent ~ "ProPowerBot"){ return 403; } if ($http_user_agent ~ "ProWebWalker"){ return 403; } if ($http_user_agent ~ "proximic"){ return 403; } if ($http_user_agent ~ "psbot"){ return 403; } if ($http_user_agent ~ "PSurf15"){ return 403; } if ($http_user_agent ~ "psycheclone"){ return 403; } if ($http_user_agent ~ "ptd-crawler"){ return 403; } if ($http_user_agent ~ "Pump"){ return 403; } if ($http_user_agent ~ "Purebot"){ return 403; } if ($http_user_agent ~ "PycURL"){ return 403; } if ($http_user_agent ~ "Python"){ return 403; } if ($http_user_agent ~ "python-requests"){ return 403; }
- if ($http_user_agent ~ "Python-urllib"){ return 403; } if ($http_user_agent ~ "QRVA"){ return 403; } if ($http_user_agent ~ "QueryN\ Metasearch"){ return 403; } if ($http_user_agent ~ "QuerySeekerSpider"){ return 403; } if ($http_user_agent ~ "Radiation\ Retriever"){ return 403; } if ($http_user_agent ~ "RealDownload"){ return 403; } if ($http_user_agent ~ "Reaper"){ return 403; } if ($http_user_agent ~ "Recorder"){ return 403; } if ($http_user_agent ~ "ReGet"){ return 403; } if ($http_user_agent ~ "RepoMonkey"){ return 403; } if ($http_user_agent ~ "Riddler"){ return 403; } if ($http_user_agent ~ "RMA"){ return 403; } if ($http_user_agent ~ "rogerbot"){ return 403; } if ($http_user_agent ~ "RSurf15"){ return 403; } if ($http_user_agent ~ "Ruby"){ return 403; } if ($http_user_agent ~ "Runet-Research-Crawler"){ return 403; } if ($http_user_agent ~ "SafeSearch"){ return 403; } if ($http_user_agent ~ "Scooter"){ return 403; } if ($http_user_agent ~ "Scrapy"){ return 403; } if ($http_user_agent ~ "SearchBot"){ return 403; } if ($http_user_agent ~ "searchpreview"){ return 403; } if ($http_user_agent ~ "searchvoodoo"){ return 403; } if ($http_user_agent ~ "Seeker"){ return 403; } if ($http_user_agent ~ "semantic"){ return 403; } if ($http_user_agent ~ "SemrushBot"){ return 403; } if ($http_user_agent ~ "SEO\ search\ Crawler"){ return 403; } if ($http_user_agent ~ "Seopult"){ return 403; } if ($http_user_agent ~ "SEOsearch"){ return 403; } if ($http_user_agent ~ "SetLinks"){ return 403; } if ($http_user_agent ~ "SeznamBot"){ return 403; } if ($http_user_agent ~ "ShablastBot"){ return 403; } if ($http_user_agent ~ "Siphon"){ return 403; } if ($http_user_agent ~ "SISTRIX"){ return 403; } if ($http_user_agent ~ "SiteBot"){ return 403; } if ($http_user_agent ~ "sitecheck"){ return 403; } if ($http_user_agent ~ "SiteSnagger"){ return 403; } if ($http_user_agent ~ "Slurp"){ return 403; }
- if ($http_user_agent ~ "SlySearch"){ return 403; } if ($http_user_agent ~ "SmartDownload"){ return 403; } if ($http_user_agent ~ "SMTBot"){ return 403; } if ($http_user_agent ~ "SMUrlExpander"){ return 403; } if ($http_user_agent ~ "Snagger"){ return 403; } if ($http_user_agent ~ "Snake"){ return 403; } if ($http_user_agent ~ "snap.com"){ return 403; } if ($http_user_agent ~ "Snapbot"){ return 403; } if ($http_user_agent ~ "SNAPSHOT"){ return 403; } if ($http_user_agent ~ "Snoopy"){ return 403; } if ($http_user_agent ~ "socialmediascanner"){ return 403; } if ($http_user_agent ~ "sogou"){ return 403; } if ($http_user_agent ~ "Sogou"){ return 403; } if ($http_user_agent ~ "sohu\ agent"){ return 403; } if ($http_user_agent ~ "solomono"){ return 403; } if ($http_user_agent ~ "Soup"){ return 403; } if ($http_user_agent ~ "SpaceBison"){ return 403; } if ($http_user_agent ~ "SpankBot"){ return 403; } if ($http_user_agent ~ "spanner"){ return 403; } if ($http_user_agent ~ "spbot"){ return 403; } if ($http_user_agent ~ "spredbot"){ return 403; } if ($http_user_agent ~ "sproose"){ return 403; } if ($http_user_agent ~ "Sqworm"){ return 403; } if ($http_user_agent ~ "SSurf15"){ return 403; } if ($http_user_agent ~ "statdom"){ return 403; } if ($http_user_agent ~ "StatOnlineRuBot"){ return 403; } if ($http_user_agent ~ "Stripper"){ return 403; } if ($http_user_agent ~ "Sucker"){ return 403; } if ($http_user_agent ~ "suggybot"){ return 403; } if ($http_user_agent ~ "SuperBot"){ return 403; } if ($http_user_agent ~ "Superfeedr"){ return 403; } if ($http_user_agent ~ "SuperHTTP"){ return 403; } if ($http_user_agent ~ "Surfbot"){ return 403; } if ($http_user_agent ~ "SurveyBot"){ return 403; } if ($http_user_agent ~ "suzuran"){ return 403; } if ($http_user_agent ~ "SWeb"){ return 403; } if ($http_user_agent ~ "Synapse"){ return 403; } if ($http_user_agent ~ "Szukacz"){ return 403; }
- if ($http_user_agent ~ "tAkeOut"){ return 403; } if ($http_user_agent ~ "Teleport"){ return 403; } if ($http_user_agent ~ "Telesoft"){ return 403; } if ($http_user_agent ~ "The\ Intraformant"){ return 403; } if ($http_user_agent ~ "TheNomad"){ return 403; } if ($http_user_agent ~ "TightTwatBot"){ return 403; } if ($http_user_agent ~ "Titan"){ return 403; } if ($http_user_agent ~ "toCrawl"){ return 403; } if ($http_user_agent ~ "trendictionbot"){ return 403; } if ($http_user_agent ~ "Triton"){ return 403; } if ($http_user_agent ~ "True_Robot"){ return 403; } if ($http_user_agent ~ "TSearcher"){ return 403; } if ($http_user_agent ~ "TSurf15"){ return 403; } if ($http_user_agent ~ "ttCrawler"){ return 403; } if ($http_user_agent ~ "turingos"){ return 403; } if ($http_user_agent ~ "TurnitinBot"){ return 403; } if ($http_user_agent ~ "TweetmemeBot"){ return 403; } if ($http_user_agent ~ "Twiceler"){ return 403; } if ($http_user_agent ~ "ubermetrics"){ return 403; } if ($http_user_agent ~ "Under\ the\ Rainbow"){ return 403; } if ($http_user_agent ~ "UnwindFetchor"){ return 403; } if ($http_user_agent ~ "URL\ Control"){ return 403; } if ($http_user_agent ~ "UrlDispatcher"){ return 403; } if ($http_user_agent ~ "urllib"){ return 403; } if ($http_user_agent ~ "URLSpiderPro"){ return 403; } if ($http_user_agent ~ "URLy\ Warning"){ return 403; } if ($http_user_agent ~ "User-Agent"){ return 403; } if ($http_user_agent ~ "uTorrent"){ return 403; } if ($http_user_agent ~ "Vacuum"){ return 403; } if ($http_user_agent ~ "VadixBot"){ return 403; } if ($http_user_agent ~ "VCI"){ return 403; } if ($http_user_agent ~ "veoozbot"){ return 403; } if ($http_user_agent ~ "virus\ bot"){ return 403; } if ($http_user_agent ~ "Virusdie"){ return 403; } if ($http_user_agent ~ "VoidEYE"){ return 403; } if ($http_user_agent ~ "voyager"){ return 403; } if ($http_user_agent ~ "Voyager"){ return 403; }
- if ($http_user_agent ~ "W3\ SiteSearch\ Crawler"){ return 403; } if ($http_user_agent ~ "W3C"){ return 403; } if ($http_user_agent ~ "Wayback Machine"){ return 403; } if ($http_user_agent ~ "WBSearchBot"){ return 403; } if ($http_user_agent ~ "Weazel"){ return 403; } if ($http_user_agent ~ "Web\ Downloader"){ return 403; } if ($http_user_agent ~ "Web\ Image\ Collector"){ return 403; } if ($http_user_agent ~ "Web\ Spy"){ return 403; } if ($http_user_agent ~ "Web\ Sucker"){ return 403; } if ($http_user_agent ~ "WebAlta"){ return 403; } if ($http_user_agent ~ "WebAuto"){ return 403; } if ($http_user_agent ~ "Webbandit"){ return 403; } if ($http_user_agent ~ "WebBandit"){ return 403; } if ($http_user_agent ~ "WebCapture"){ return 403; } if ($http_user_agent ~ "Webclipping.com"){ return 403; } if ($http_user_agent ~ "webcollage"){ return 403; } if ($http_user_agent ~ "WebCopier"){ return 403; } if ($http_user_agent ~ "WebEMailExtrac"){ return 403; } if ($http_user_agent ~ "WebEnhancer"){ return 403; } if ($http_user_agent ~ "WebFetch"){ return 403; } if ($http_user_agent ~ "WebGo\ IS"){ return 403; } if ($http_user_agent ~ "WebHook"){ return 403; } if ($http_user_agent ~ "WebLeacher"){ return 403; } if ($http_user_agent ~ "weblist"){ return 403; } if ($http_user_agent ~ "WebmasterWorld"){ return 403; } if ($http_user_agent ~ "WebMiner"){ return 403; } if ($http_user_agent ~ "WebMirror"){ return 403; } if ($http_user_agent ~ "WebReaper"){ return 403; } if ($http_user_agent ~ "WebRecorder"){ return 403; } if ($http_user_agent ~ "WebSauger"){ return 403; } if ($http_user_agent ~ "WebSite"){ return 403; } if ($http_user_agent ~ "Website\ eXtractor"){ return 403; } if ($http_user_agent ~ "Website\ Quester"){ return 403; } if ($http_user_agent ~ "WebSpy"){ return 403; } if ($http_user_agent ~ "Webster"){ return 403; } if ($http_user_agent ~ "WebStripper"){ return 403; } if ($http_user_agent ~ "WebVulnCrawl"){ return 403; }
- if ($http_user_agent ~ "WebWhacker"){ return 403; } if ($http_user_agent ~ "WebZIP"){ return 403; } if ($http_user_agent ~ "wegobot"){ return 403; } if ($http_user_agent ~ "Wells\ Search"){ return 403; } if ($http_user_agent ~ "WEP\ Search"){ return 403; } if ($http_user_agent ~ "Wget"){ return 403; } if ($http_user_agent ~ "Whacker"){ return 403; } if ($http_user_agent ~ "Widow"){ return 403; } if ($http_user_agent ~ "Windows\ 95"){ return 403; } if ($http_user_agent ~ "WISENutbot"){ return 403; } if ($http_user_agent ~ "WordPress"){ return 403; } if ($http_user_agent ~ "woriobot"){ return 403; } if ($http_user_agent ~ "WWW-Collector-E"){ return 403; } if ($http_user_agent ~ "WWWOFFLE"){ return 403; } if ($http_user_agent ~ "Xaldon"){ return 403; } if ($http_user_agent ~ "Xenu"){ return 403; } if ($http_user_agent ~ "Xenu's"){ return 403; } if ($http_user_agent ~ "x-Tractor"){ return 403; } if ($http_user_agent ~ "Yanga"){ return 403; } if ($http_user_agent ~ "Yeti"){ return 403; } if ($http_user_agent ~ "YottosBot"){ return 403; } if ($http_user_agent ~ "Zeus"){ return 403; } if ($http_user_agent ~ "Zeus\ Link\ Scout"){ return 403; } if ($http_user_agent ~ "zitebot"){ return 403; } if ($http_user_agent ~ "ZmEu"){ return 403; } if ($http_user_agent ~ "Zyborg"){ return 403; }
- # в файлах, начинающихся на «.» могут лежать пароли или оставшиеся настройки от Апача - отдавать это ни к чему.
- location ~ /\. {
- access_log off;
- log_not_found off;
- }
- # Wildcard include / Закоментили(отключили) дополнительные настройки
- #include /etc/nginx/conf.d/*.conf;
- }
- # SSL PCI Compliance
- ssl_session_cache shared:SSL:10m;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_prefer_server_ciphers on;
- ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
- # Error pages / Страницы ошибок
- error_page 403 /error/403.html;
- error_page 404 /error/404.html;
- error_page 502 503 504 /error/50x.html;
- # Log format
- log_format main '$remote_addr - $remote_user [$time_local] $request '
- '"$status" $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
- log_format bytes '$body_bytes_sent';
- #access_log /var/log/nginx/access.log main;
- access_log off;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement