更改dir.conf文件中的文件首选项后,apache服务器提供index.html而不是index.php

更改dir.conf文件中的文件首选项后,apache服务器提供index.html而不是index.php,php,apache2,Php,Apache2,我更改了dir.conf文件中的文件首选项: $sudo nano /etc/apache2/mods-enabled/dir.conf <IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm </IfModule> $sudo nano/etc/apache2/mods enabled/dir.conf Director

我更改了dir.conf文件中的文件首选项:

$sudo nano /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
$sudo nano/etc/apache2/mods enabled/dir.conf
DirectoryIndex.php index.html index.cgi index.pl index.xhtml index.htm
这意味着index.php将获得第一个首选项,对吗

/var/www/html
中,我有两个文件,即index.html和index.php。
但是,当我在浏览器中访问我的ip_地址时,提供的是index.html而不是index.php。我遗漏了什么吗?

更改您的
dir.conf
文件:

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

DirectoryIndex.html index.cgi index.pl index.php index.xhtml index.htm

我们不是应该把index.php放在最左边,这样它就可以得到第一个首选项。实际上,它不提供这两个文件中的任何一个。它显示“当前无法处理此请求”。如果错误为“当前无法处理此请求”,则可能是由于php文件中的代码问题。请将index.php修改为一个简单的index.php,如,并查看结果。不知道我做错了什么。事实上我一直在努力。很好你已经解决了这个问题。祝你今天愉快。你也是!!!!!!!!