Ubuntu 修改Apache2网站根目录及默认网页

1.修改根目录: 

在 /etc/apache2/sites-available 中修改 000-default.conf 

中的DocumentRoot /var/www/ 修改为想要的目录 

比如:DocumentRoot /var/www/html/dokuwiki 
修改完后重启:sudo /etc/init.d/apache2 restart

2.修改默认网页: 
修改/etc/apache2/mods-available/dir.conf中的内容 
原来是:

<IfModule mod_dir.c>
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

添加上想要的文件或路径,优先级是从开始往后逐次读取(无文件就读下一个),如添加index.php、 dokuwiki

<IfModule mod_dir.c>
    DirectoryIndex dokuwiki index.php index.html index.cgi index.pl index.php index.xhtml index.htm 
</IfModule>

 

posted @ 2019-06-28 13:09  我来搬砖了  阅读(6548)  评论(0编辑  收藏  举报