0
我有nginx的工作很好,我想補充基本身份驗證:配置nginx使用基本認證?
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
http {
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
open_file_cache max=100;
log_format octohost '$http_x_forwarded_for - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http_x_request_id"';
access_log /dev/stdout;
error_log /dev/stdout info;
server {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/sites-available/.htpasswd;
}
}
daemon off;
但是,它不要求用戶名/密碼。 .htpasswd文件簡單地是「測試:測試」...我在這丟失了什麼?
這沒有做任何事情。 –