获取index.php列表而不是网站

时间:2018-02-02 05:26:51

标签: php ubuntu-16.04

我的设置是

Ubuntu 14.04
php 5.x

该网站运作良好。

我将系统升级为:

Ubuntu 16.03
php 7

当我这样做时:

php -v

我明白了:

PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

我有:

Server version: Apache/2.4.18 (Ubuntu)
Server built:   2017-09-18T15:09:02

但是,当我尝试访问该网站时,我现在在浏览器窗口中看到文件index.php的列表。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您应该使用行.htaccessDirectoryIndex index.php index.html文件添加到目录根目录,该行告诉Apache在目录中首先使用index.php,然后使用index.html,这是为什么您会看到index.php

的目录列表
相关问题