Загрузите index.html по умолчанию в apache2
Я настроил apache2 веб-сервер и кот с mod_jk модуль между, чтобы делегировать статический контент apache2,
Я создал /var/www/example/index.html и хотите, чтобы это было загружено при входе www.example.com/
Я могу получить доступ www.example.com/index.html прямо, но www.example.com/ загружает страницу по умолчанию.
Вот мой конфигурационный файл 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"но ничего не работает.
Какие-либо предложения?
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>