共計 1698 個字符,預計需要花費 5 分鐘才能閱讀完成。
本文丸趣 TV 小編為大家詳細介紹“Ubuntu 如何修改 Apache 的默認目錄”,內容詳細,步驟清晰,細節處理妥當,希望這篇“Ubuntu 如何修改 Apache 的默認目錄”文章能幫助大家解決疑惑,下面跟著丸趣 TV 小編的思路慢慢深入,一起來學習新知識吧。
一、查找 apache 的配置文件
# cd /etc/apache2/
發現 apache2.conf 和 httpd.conf 文件,沒有找到關于目錄修改的配置,且 http.conf 為空文件。
二、上網搜索
apache2.conf 里并沒有 documentroot 項,httpd.conf 又是空的,www.linuxidc.com 因此肯定在其他的文件中。經過搜索,發現在 /etc /apache2/sites-enabled/000-default 中,里面有這樣的內容:
復制代碼 代碼如下:
virtualhost *:80 serveradmin webmaster@localhost
documentroot /var/www directory / options followsymlinksallowoverride none /directory directory /var/www / options indexes followsymlinks multiviewsallowoverride noneorder allow,denyallow from all /directory
scriptalias /cgi-bin/ /usr/lib/cgi-bin/ directory “/usr/lib/cgi-bin”allowoverride noneoptions +execcgi -multiviews +symlinksifownermatchorder allow,denyallow from all /directory
修改方法:將上面的 /var/www 修改為 /home/www 即可。
三、找回丟失的 /etc /apache2/sites-enabled/000-default 文件
不知何種原因,000-default 竟然丟了,apache 服務也不能正常運行了。還好我有一個備用服務器,經查 000-default 實際上是一個軟鏈接,指向../sites-available/default 文件。
# cd /etc /apache2/sites-enabled/# ln -s ../sites-available/default 000-default# /etc/init.d/apache2 restart
* restarting web server apache2apache2: could not reliably determine the server s fully qualified domain name, using 127.0.1.1 for servername… waiting apache2: could not reliably determine the server s fully qualified domain name, using 127.0.1.1 for servername…done.
=== 由上面 apache 啟動的反饋信息,可以看到 apache 還是有一點小問題的,不過不影響。
下表為空間分配。
filesystem size used avail use% mounted on
/dev/sda5 1.9g 36m 1.8g 2% /tmp
/dev/sda9 209m 21m 177m 11% /boot
/dev/sda1 276g 7.0g 255g 3% /home
/dev/sda6 8.6g 670m 7.5g 9% /usr
/dev/sda3 1.9g 186m 1.6g 11% /var
讀到這里,這篇“Ubuntu 如何修改 Apache 的默認目錄”文章已經介紹完畢,想要掌握這篇文章的知識點還需要大家自己動手實踐使用過才能領會,如果想了解更多相關內容的文章,歡迎關注丸趣 TV 行業資訊頻道。