CodeForces 多人 rating 圖原指令碼失效解決方案
阿新 • • 發佈:2021-08-14
Nginx訪問控制
一、黑(白)名單
[root@web-nginx conf.d]# vim access-control.conf server { listen 80; server_name www.access-control.com; access_log /var/log/nginx/access-control-access.log main; error_log /var/log/nginx/access-control-error.log; location /{ root /var/www/access; index index.php index.htm index.html; } #設定白名單訪問/status頁面 location /status{ allow 192.168.133.0/24; deny all; stub_status on; access_log off; } }
二、賬號訪問
配置若有遺漏或錯誤,請評論留言。[root@web-nginx conf.d]# yum -y install httpd-tools [root@web-nginx conf.d]# htpasswd -c /var/www/auth_conf test password: [root@web-nginx conf.d]# vim access-control.conf server { listen 80; server_name www.access-control.com; access_log /var/log/nginx/access-control-access.log main; error_log /var/log/nginx/access-control-error.log; location /{ root /var/www/access; index index.php index.htm index.html; } #指定頁面設定賬號訪問 location = /xxx.html{ auth_basic "input user,password!"; auth_basic_user_file /var/www/auth_conf; index index.html index.htm; } }