Last active
March 11, 2020 07:58
-
-
Save Radon8472/3a25e9d5fe68ee7fda7062165b404d90 to your computer and use it in GitHub Desktop.
My collection of usefull apache config elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# this file should ask for password, but only when we are on develop-domain | |
# on all other hosts it should allow access without requsting user data | |
# | |
# SetEnvIf Host develop.myserver.de passreq | |
SetEnvIf Host "^develop\.([^\.]*)\.de$" passreqprev | |
AuthType Basic | |
AuthName "Password Required" | |
AuthUserFile /www/my-server-path/public/.htpasswd | |
<IfModule mod_authz_core.c> | |
## This block currently not works like it should do. | |
## When Env is set it ALWAYS Blocks, and without env it allways allows access. Password is never requested | |
# @see: https://wissen.profihost.com/wissen/artikel/wie-kann-ich-den-zugriff-auf-meine-seite-steuern/ | |
# @see: https://stackoverflow.com/a/30888914/2377961 | |
<RequireAny> | |
<RequireAll> | |
Require not env passreq | |
Require all granted | |
</RequireAll> | |
<RequireAll> | |
Require valid-user | |
</RequireAll> | |
</RequireAny> | |
</IfModule> | |
<IfModule !mod_authz_core.c> | |
Require valid-user | |
Order allow,deny | |
Allow from all | |
Deny from env=passreq | |
Satisfy Any | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Controll Expire Times according Types: | |
<IfModule mod_expires.c> | |
# Enable expirations | |
ExpiresActive On | |
# Default directive | |
ExpiresDefault "access plus 1 month" | |
# All Images and Icons-Types | |
ExpiresByType image/* "access plus 1 month" | |
# CSS | |
ExpiresByType text/css "access plus 1 month" | |
# Javascript | |
ExpiresByType application/javascript "access plus 1 year" | |
</IfModule> | |
<IfModule mod_alias.c> | |
# block access to all files with the listed extension | |
RedirectMatch 403 ^/.+\.(rar|zip|gz)$ | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment