修改网站默认目录
Apache2的默认目录在:/var/www/html
配置文件:/etc/apache2/sites-enabled/000-default
找到以下位置:
DocumentRoot /var/www/html
修改:
DocumentRoot /var/www/html ...(你自己设定的文件目录)
重启Apache服务:
systemctl restart apache2.service
(or)
/etc/init.d/apache2 restart
修改默认网站主页
配置文件:/etc/apache2/mods-enabled/dir.conf
如若不知道你的文件位置就输入以下命令:
grep -iR DirectoryIndex /etc/apache2
呈现结果如下:
root@shain:/etc/apache2# grep -iR DirectoryIndex /etc/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
在DirectoryIndex 在后面添加文件。如index.php等
版权声明:本文为qq_37427828原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。