【问题标题】:should apache default page show up when no sites are enabled?未启用任何站点时是否应显示 apache 默认页面?
【发布时间】:2016-09-11 16:10:26
【问题描述】:

当我这样做时:

sudo a2dissite

我明白了

Your choices are: 

意味着所有网站都被禁用。

当我将我的 IP 本地网络地址输入浏览器时,我会得到默认的 Apache 页面。

http://192.168.1.101/ (putting this in the browser address bar gets me the default apache page)

使用

停止 apache
sudo service apache2 stop

给我“无法访问此站点”,因此 apache 正在提供该默认页面。

那么,当没有启用任何站点时显示 apache 默认页面是否合适?

跟进:如何将不同的目录设为默认目录?我有一个 test.conf 设置

<VirtualHost 127.0.0.2:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /home/myusername/websites/wp-test-site/site

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

我认为启用它会使默认站点文件夹成为 /home/myusername/websites/wp-test-site/site,但事实并非如此。

是的,我正在使用 sudo 重新启动。

【问题讨论】:

    标签: apache2


    【解决方案1】:

    将 .htaccess 文件添加到文档根目录。 更改默认文件显示如下

    DirectoryIndex index.php default.html
    

    现在将一些 index.php 放在文档根目录中。 接下来,您可以从索引文件中指向用户指向的位置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-01
      • 1970-01-01
      • 2016-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多