實現狀態頁面和家目錄的web共享,並實驗basic驗證

實驗:實現家目錄的web共享,並實驗basic驗證

1.修改配置文件

vim /etc/httpd/conf.d/userdir.conf

<IfModule mod_userdir.c>  
#UserDir disabled  
UserDir public  
</IfModule>

實現狀態頁面和家目錄的web共享,並實驗basic驗證

#  
# Control access to UserDir directories.  The following is an example  
# for a site where these directories are restricted to read-only.  
#  
#<Directory "/home/*/public_html">  
#    AllowOverride FileInfo AuthConfig Limit Indexes  
#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec  
#    Require method GET POST OPTIONS  
#</Directory>  
<directory /home/wang/public>  
allowoverride authconfig                                
</directory>  

實現狀態頁面和家目錄的web共享,並實驗basic驗證

2. 控制訪問組訪問權限

vim /home/wang/public/.htaccess

authtype basic  
AuthName "admin Page"  
AuthUserFile "/etc/httpd/conf.d/.httpuser"  
AuthGroupFile "/etc/httpd/conf.d/.httpgroup"                                  
Require group g1 g2

實現狀態頁面和家目錄的web共享,並實驗basic驗證

3.創建家目錄文件,並賦予apache賬戶acl讀權限

mkdir ~wang/public
setfacl -m u:apache:x ~wang/

4.測試

訪問 http://localhost/~wang/index.html

實驗:實現狀態頁面

1. 檢查是否加載status模塊功能

httpd -M | grep status
實現狀態頁面和家目錄的web共享,並實驗basic驗證

2. 修改配置文件添加參數

vim /etc/httpd/conf.d/test.conf

<Location "/status">  
<requireany>  
require all denied  
require ip 192.168.36.1  
</requireany>  
SetHandler server-status  
</Location>  
ExtendedStatus On 

實現狀態頁面和家目錄的web共享,並實驗basic驗證

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章