溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

VirtualHost _default_ 設(shè)置虛擬主機(jī)的默認(rèn)根目錄

發(fā)布時(shí)間:2020-07-12 21:30:05 來(lái)源:網(wǎng)絡(luò) 閱讀:601 作者:jia_xl 欄目:開(kāi)發(fā)技術(shù)

順手記錄一下,


NameVirtualHost *:80


<VirtualHost _default_:80>

    DocumentRoot "/var/www/html"

</VirtualHost>


<VirtualHost *:80>

    ServerName www.abc.com

    DocumentRoot "/var/www/html/abc"

   <Directory /var/www/html/abc>

     Options Indexes FollowSymLinks

     AllowOverride None

     Order deny,allow

     Allow from all

   </Directory>

</VirtualHost>


在httpd.conf里增加虛擬主機(jī)時(shí)寫(xiě)的DocumentRoot會(huì)把上面的根目錄覆蓋掉,這樣根目錄其他的文件夾就沒(méi)法訪(fǎng)問(wèn)了,添加VirtualHost _default_可以把DocumentRoot寫(xiě)回原先的根目錄。需要打開(kāi)NameVirtualHost,否則Apache開(kāi)啟時(shí)會(huì)報(bào)warning。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI