如何修改Apache服务器的默许首页
要修改Apache服务器的默许首页,可以依照以下步骤进行操作:
打开 Apache 的配置文件。可以通过以下命令找到 Apache 的配置文件:
sudo nano /etc/apache2/apache2.conf
找到 DirectoryIndex 指令,它会列出服务器默许的首页文件。默许情况下,它多是这样的:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
修改 DirectoryIndex 指令,将你想要设置为默许首页的文件放在第一名。例如,如果你想将 index.php 设置为默许首页,可以这样修改:
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
保存文件并退出编辑器。
重新加载 Apache 使配置生效:
sudo systemctl reload apache2
现在,你已成功修改了 Apache 服务器的默许首页。当用户访问你的网站时,会首先显示设置的默许首页文件。
TOP