Загрузить index.html по умолчанию в apache2

Я установил веб-сервер apache2 и tomcat с помощью mod_jk промежуточный модуль для делегирования статического содержимого apache2 .

Я создал /var/www/example/index.html и хочу, чтобы он загружался при вводе www.example.com/

Я могу получить доступ к www. example.com/index.html напрямую, но www.example.com/ загружает страницу Tomcat по умолчанию.

Вот мой файл конфигурации apache:

<VirtualHost *:80>
    DocumentRoot /var/www/example
    <Directory /var/www/example>
            DirectoryIndex index.html
            #Options Indexes FollowSymLinks
            #AllowOverride None
            #Require all granted
    </Directory>
    # Static files in the examples webapp are served by Apache
    # Alias /examples /opt/tomcat/webapps/example
    # All requests go to ajp13_worker by default
    JkMount /* ajp13_worker
    # Serve this files using Apache
    JkUnMount /*.html ajp13_worker
    JkUnMount /*.jpg ajp13_worker
    JkUnMount /*.gif ajp13_worker
    JkUnMount /*.png ajp13_worker
    JkUnMount /*.svg ajp13_worker
    JkUnMount /*.js ajp13_worker
    JkUnMount /*.css ajp13_worker

    ServerAdmin info@example

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

</VirtualHost>

Я попытался изменить настройки индексного файла, добавив файл .htaccess в / var / www / example с помощью " DirectoryIndex index.html ", но ничего не работает.

Есть предложения?

0
задан 29 June 2018 в 18:11
1 ответ

Хорошо, я решил. Изменен файл конфигурации на этот:

<VirtualHost *:80>
DocumentRoot /var/www/example
<Directory /var/www/example>
        DirectoryIndex index.html
        #Options Indexes FollowSymLinks
        #AllowOverride None
        #Require all granted
</Directory>
# Static files in the examples webapp are served by Apache
Alias /example /opt/tomcat/webapps/example
# All requests go to ajp13_worker by default
JkMount /* ajp13_worker
# Serve this files using Apache
JkUnMount /example/*.html ajp13_worker
JkUnMount /example/*.jpg ajp13_worker
JkUnMount /example/*.gif ajp13_worker
JkUnMount /example/*.png ajp13_worker
JkUnMount /example/*.svg ajp13_worker
JkUnMount /example/*.js ajp13_worker
JkUnMount /example/*.css ajp13_worker

ServerAdmin info@example

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

</VirtualHost>
0
ответ дан 5 December 2019 в 05:47

Теги

Похожие вопросы