apache虛擬目錄的建立及身分識別驗證功能的開啟

來源:互聯網
上載者:User

標籤:ofo   密碼   功能   vim   rect   服務   -o   重啟   options   

apache虛擬目錄的建立及身分識別驗證功能的開啟

實驗環境:服務端:centos6.5 IP192.168.10.10
用戶端:win7
1.echo "test01" > /var/www/html/index.html //將首頁改為test01
vim /etc/httpd/conf/httpd.conf

//添加可識別網頁檔案類型
vim vuser.conf //自訂建立虛擬目錄
Alias /test "/opt/test"
<Directory "/opt/test/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
AuthName "hello"
authtype basic
authuserfile /etc/httpd/user
require Valid-user
</Directory>

echo "this is vdir test" > /opt/test/index.html //在opt/test/ 建立網頁"this is vdir test"
用戶端訪問服務端IP:http://192.168.10.10/test/

虛擬目錄建立成功
2.開啟身分識別驗證功能
htpasswd -c /etc/httpd/user baixiaosheng //建立虛擬使用者baixiaosheng,並設定密碼
vim vuser.conf

service httpd restart //重啟服務
用戶端再次訪問服務端

需驗證身份才能訪問網站

apache虛擬目錄的建立及身分識別驗證功能的開啟

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.