首页 > 解决方案 > 加载 Moodle 站点时打开默认 Apache 页面的原因是什么

问题描述

我的网站www.site.com加载 apache2 'It works' 页面,而不是预期的 moode 主页,该主页位于/var/www/html/moodle. 在moodle目录中有一个索引文件index.php,但默认不使用。如果我去www.site.com/moodle网站主页来。配置文件/etc/apache2/sites-available/site.conf已启用。如何解决这个问题?

<VirtualHost *:80>
    ServerName www.site.com
    ServerAlias site.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/moodle
    DirectoryIndex index.php
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.site.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} 
    [END,NE,R=permanent]
</VirtualHost>

标签: apacheweb-servicesserverubuntu-18.04moodle

解决方案


这可以通过更改行来解决

DirectoryIndex index.php

DirectoryIndex index.php /moodle/index.php

在文件中/etc/apache2/sites-available/site.conf

来源: https ://httpd.apache.org/docs/2.4/mod/mod_dir.html


推荐阅读