httpd頁面使用者訪問認證控制

來源:互聯網
上載者:User

標籤:允許   lin   yum   訪問   ons   分享   httpd   限制   conf   

 

[[email protected] ~]# yum install -y httpd

 

客戶機地址限制

通過配置Order、Deny from、Allow from 來限制客戶機

allow、deny :先"允許"後"拒絕" ,預設拒絕所有為明確的客戶機地址。

deny、allow:先"拒絕"後"允許",預設允許所有為明確的客戶機地址

使用者授許可權制

httpd伺服器支援使用摘要認證(Digest)和基本認證(Basic)兩種方式。使用摘要認證需要在編譯httpd之前添加"--enable-auth-digest"選項、但並不是所有的瀏覽器都支援摘要認證、基本認證不需要預先配置。

[[email protected] ~]# vim /etc/httpd/conf/httpd.conf 

<Directory "/var/www/html/">     #設定許可權的頁面路徑
AllowOverride None  #是否允許覆蓋存取控制

[Options Indexes FollowSymLinks ]
Order allow,deny
Allow from all
AuthName "Jfedu Access"         #定義受保護領域的名稱 
AuthType Basic      #設定認證類型,Basic表示基本認證
AuthUserFile /etc/httpd/conf/htpasswd.users     #設定用於使用者帳號,密碼的認證檔案路徑
Require valid-user     #要求認證檔案存在的使用者才能訪問
</Directory

重啟服務

/etc/inint.d/httpd restart 

[[email protected] ~]# htpasswd -c /etc/httpd/conf/htpasswd.users bxy   #建立認證使用者

[[email protected] ~]# cat /etc/httpd/conf/htpasswd.users 

bxy:0PsCdMzno5PiY
admin:pe7Zf54sJJPA2

省略-c選擇、表示使用者資料檔案已經存在、添加新使用者或修改現有使用者的密碼、則不需要指定-c選項

 驗證存取控制

 

httpd頁面使用者訪問認證控制

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.