新聞中心
User Directory或Userdir是一個apache模塊,它允許使用http://example.com/~user/語法通過Apache web服務(wù)器檢索特定于用戶的目錄。

創(chuàng)新互聯(lián)服務(wù)項目包括奉新網(wǎng)站建設(shè)、奉新網(wǎng)站制作、奉新網(wǎng)頁制作以及奉新網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,奉新網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到奉新省份的部分城市,未來相信會繼續(xù)擴大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
例如,當(dāng)啟用mod_userdir模塊時,系統(tǒng)上的用戶帳戶將能夠通過Apache Web服務(wù)器訪問其主目錄中的內(nèi)容。
在本文中,我們將向您展示如何使用Apache Web服務(wù)器在RHEL,centos和Fedora服務(wù)器上啟用Apache userdirs(mod_userdir)。
第1步:安裝Apache HTTP Server
要安裝Apache Web服務(wù)器,請在Linux發(fā)行版上使用以下命令。
在CentOS 7上安裝Apache
第2步:啟用Apache Userdirs
現(xiàn)在,您需要配置Apache Web服務(wù)器以在配置文件/etc/apache2/mods-available/userdir.conf中使用此模塊,該文件已配置了最佳選項。
# vi /etc/httpd/conf.d/userdir.conf
然后驗證內(nèi)容如下所示。
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
## Apache 2.4 users use following ##
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Require method GET POST OPTIONS
## Apache 2.2 users use following ##
Options Indexes Includes FollowSymLinks
AllowOverride All
Allow from all
Order deny,allow
要允許少數(shù)用戶訪問UserDir目錄,但不允許其他人訪問,請在配置文件中使用以下設(shè)置。
UserDir disabled
UserDir enabled testuser1 testuser2 testuser3
要允許所有用戶訪問UserDir目錄,但對少數(shù)用戶禁用此功能,請在配置文件中使用以下設(shè)置。
UserDir enabled
UserDir disabled testuser4 testuser5 testuser6
根據(jù)需要進行配置設(shè)置后,需要重新啟動Apache Web服務(wù)器以應(yīng)用最近的更改。
# systemctl restart httpd.service [在 SystemD 上]
# service httpd restart [在 SysVInit 上]
第3步:創(chuàng)建用戶目錄
接下來,在用戶home和public_html目錄上應(yīng)用正確的權(quán)限。
另外,為Apache homedir(httpd_enable_homedirs)設(shè)置正確的SELinux context。
第4步:測試啟用Apache Userdir
最后,通過將瀏覽器指向服務(wù)器主機名或IP地址,然后是用戶名來驗證Userdir。
如果需要,還可以通過創(chuàng)建以下文件來測試HTML頁面和PHP信息。
如下圖:
phpinfo();
?>
OK,在本文中,我們解釋了如何啟用Userdir模塊來允許用戶共享來自其主目錄的內(nèi)容。如果您對本文有任何疑問,請在下面的評論部分提出。
網(wǎng)頁題目:如何在RHEL/CentOS上啟用ApacheUserdir模塊
文章鏈接:http://fisionsoft.com.cn/article/cdhjgpe.html


咨詢
建站咨詢
