Quantcast
Channel: Welcome to Andy's Blog
Viewing all articles
Browse latest Browse all 10

nginx 虚拟主机 + simple password 认证 on ubuntu

$
0
0
ubuntu 上nginx 虚拟主机需要创建在 site-enabled 下面
 
root@ubt01:/etc/nginx/sites-enabled# cat /etc/nginx/sites-enabled/andysite
log_format andy '$remote_addr - $remote_user [$time_local] '
                    '"$request" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent" "$http_X_Forwarded_For"';
server {
  listen          9100;
 
  location / {
    access_log /var/log/nginx/access.log andy;
    proxy_pass    http://127.0.0.1:9200;
    proxy_read_timeout 90;
    auth_basic "Restricted";
    auth_basic_user_file /etc/nginx/andy-htpasswd;
  }
}
 
need to use htpasswd to create simple password:
 
root@ubt01:~# apt-get install apache2-utils
root@ubt01:/etc/nginx# htpasswd -c -d andy-htpasswd andy
New password:
Re-type new password:
Adding password for user andy
 

Viewing all articles
Browse latest Browse all 10

Trending Articles