How to make apache serve files from a certain directory

Viewed 9

I have enabled the following configuration (there's a symlink to the file in /etc/apache2/sites-enabled):

<VirtualHost *:443>
    ServerName localhost
    DocumentRoot /var/www/html/public/static
    <Directory /var/www/html/public/static>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    SSLEngine On
    SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I have an index.html file at /var/www/html/public and another one at /var/www/html/public/static. Even though I set the Directory to the static folder, I only can access it under localhost/static. Why I can't see the index.html at static under localhost? Why do I have to add static to the url? Isn't that the point of the Directory directive?

0 Answers
Related