我的网站www.site.com
加载apache2'It works'页面,而不是位于/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>
这可以通过更改行来解决
DirectoryIndex index.php
to
DirectoryIndex index.php /moodle/index.php
在文件/etc/apache2/sites-available/site.conf
中。