1.修改根目录:
修改 /etc/apache2/sites-available/000-default.conf 中
的 DocumentRoot /var/www/ 修改为想要的目录
比如:DocumentRoot /var/www/html/xxx
(如果你是正在看我的搭建oj的教程 直接在 DocumentRoot /var/www/ 后添加web,改为:DocumentRoot /var/www/html/web)按i 进入编辑模式 按ESC退出编辑模式 键入 :wq 保存并退出 。
vim /etc/apache2/sites-available/000-default.conf
修改完后重启:
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、(如果你在看我的另一篇博客oj搭建,里面有index.php 则无需进行修改操作) 按i 进入编辑模式 按ESC退出编辑模式 键入 :wq 保存并退出 。
<IfModule mod_dir.c>
DirectoryIndex dokuwiki index.php index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
博客参考 https://blog.youkuaiyun.com/longchena/article/details/80153160