歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> ubuntu修改apache2默認網站目錄和默認主頁文檔

ubuntu修改apache2默認網站目錄和默認主頁文檔

日期:2017/3/1 14:56:19   编辑:關於Linux
ubuntu修改apache2默認網站目錄和默認主頁文檔 1、修改默認網站目錄 ubuntu8.10下修改apache2的默認文檔目錄 默認是在/var/www裡面 sudo gedit /etc/apache2/sites-enabled/000-default
在文檔中找到 DocumentRoot 在後面修改你要放置網頁文件的目錄。 修改完了 別忘記重啟apache2服務器 命令: sudo /etc/init.d/apache2 restart 2、修改默認主頁 修改默認主頁:一般在 sudo gedit /etc/apache2/apache2.conf裡面 找到 DirectoryIndex 在後面添加 如index.php等 不過隨apache2的版本不同 文件的放置位置不一樣 我在ubuntu8.10下面配置文件就不一樣。
別怕 輸入這個命令 grep -iR DirectoryIndex /etc/apache2 查看 DirectoryIndex 在apache2那個文件裡面。 我的就是 這樣的 /etc/apache2/mods-enabled/dir.conf: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm /etc/apache2/mods-available/dir.conf: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm 為什麼所2個文件都有呢。我也不清楚 不過我在群裡 有高手說了 其實2個文件關系是上面那個是下面那個的符號鏈接,還是一樣的。隨便添加默認文檔就可以了。
Copyright © Linux教程網 All Rights Reserved