Закрытие доступа с помощью веб авторизации (http auth)
server { listen [[IP]]:80; server_name [[DOMAIN]] *.[[DOMAIN]]; root /home/vse2.reklamu.ru/httpdocs; index index.php; access_log /var/log/nginx/[[DOMAIN]].access.log; error_log /var/log/nginx/[[DOMAIN]].error.log crit; charset utf-8; #charset windows-1251; location = /favicon.ico { log_not_found off; access_log off; break; } location = /robots.txt { allow all; log_not_found off; access_log off; index index.php; try_files $uri $uri/ /index.php?$query_string; } location / { #deny 46.101.134.155; auth_basic "Website development"; auth_basic_user_file /home/[[DOMAIN]]/authfile; index index.php; try_files $uri $uri/ /index.php?$query_string; } }
Создание файла автоизации authfile
$ php -r 'echo "admin:" . crypt("authpassword", "salt") . ": Web auth for [[DOMAIN]]";' > /home/[[DOMAIN]]/authfile