NGINX 使用者驗證

2021-09-11 05:52:46 字數 418 閱讀 5787

1.建立使用者許可權的賬號和密碼

htpasswd -c /usr/local/nginx/conf/htpasswd aming

2.新建個資料夾 /data/wwwroot/test.com

寫入檔案內容 echo 「test.com」 > /data/wwwroot/test.com/index.html

3.編寫nginx/conf/vhost

vi test.com.conf

server

}

訪問如果不輸入使用者名稱和密碼 報401錯誤

401 authorization required

如果目錄沒有可執行許可權

報403錯誤

403 forbidden

可執行chmod 777 test.com

Nginx使用者訪問及密碼驗證

需求 訪問web頁面需要進行使用者認證 使用者名為 tom,密碼為 123456 配置nginx配置檔案 root proxy vim usr local nginx conf nginx.conf server 使用htpasswd生成密碼檔案 root web01 extra which htp...

nginx密碼驗證

使用openssl生成使用者名稱和密碼 nginx配置增加 auth basic server auth auth basic user file etc nginx conf.d htpasswd htpasswd 是開源 http 伺服器 apache httpd 的乙個命令工具,用於生成 ht...

Nginx配置之訪問控制 目錄使用者驗證 防盜煉

1.訪問控制 只允許本機訪問a目錄 其他機器拒絕訪問location a2.目錄使用者驗證location bmkdir etc nginx htpasswd m etc nginx htpasswd wwwsy 使用者名稱 3.防盜煉 location c 完整的配置檔案user www 訪問控制...