Merge pull request #1630 from ArthurHoaro/fix/apache-config

Reviewed Apache configuration
This commit is contained in:
ArthurHoaro 2020-11-10 10:45:05 +01:00 committed by GitHub
commit 7e78237fc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View file

@ -13,7 +13,7 @@ RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
# Alternative (if the 2 lines above don't work) # Alternative (if the 2 lines above don't work)
# SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 # SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
# REST API # Slim URL Redirection
# Ionos Hosting needs RewriteBase / # Ionos Hosting needs RewriteBase /
# RewriteBase / # RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f

View file

@ -193,19 +193,24 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf
Require all granted Require all granted
</Directory> </Directory>
<LocationMatch "/\."> # BE CAREFUL: directives order matter!
# Prevent accessing dotfiles
RedirectMatch 404 ".*"
</LocationMatch>
<LocationMatch "\.(?:ico|css|js|gif|jpe?g|png)$"> <FilesMatch ".*\.(?!(ico|css|js|gif|jpe?g|png|ttf|oet|woff2?)$)[^\.]*$">
Require all denied
</FilesMatch>
<Files "index.php">
Require all granted
</Files>
<FilesMatch "\.(?:ico|css|js|gif|jpe?g|png|ttf|oet|woff2)$">
# allow client-side caching of static files # allow client-side caching of static files
Header set Cache-Control "max-age=2628000, public, must-revalidate, proxy-revalidate" Header set Cache-Control "max-age=2628000, public, must-revalidate, proxy-revalidate"
</LocationMatch> </FilesMatch>
# serve the Shaarli favicon from its custom location # serve the Shaarli favicon from its custom location
Alias favicon.ico /var/www/shaarli.mydomain.org/images/favicon.ico Alias favicon.ico /var/www/shaarli.mydomain.org/images/favicon.ico
</VirtualHost> </VirtualHost>
``` ```