0

I have set up apache2 web server and tomcat with mod_jk module in between to delegate static content to apache2.

I have created /var/www/example/index.html and want this to be loaded when entering www.example.com/

I can access www.example.com/index.html directly but www.example.com/ loads tomcat default page.

Here is my apache config file:

<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>

I tried changing persmisions of the index file, adding .htaccess file in /var/www/example with "DirectoryIndex index.html" but nothing works.

Any suggestions?

alexander.polomodov
  • 1,068
  • 3
  • 10
  • 14
user2908112
  • 167
  • 1
  • 13

1 Answers1

0

Ok I solved it. Changed config file to this:

<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>
user2908112
  • 167
  • 1
  • 13