Last active
October 10, 2022 08:22
-
-
Save mdpuma/db089e5f108f7d4dc457 to your computer and use it in GitHub Desktop.
nginx + apache, http to https redirect
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
# cat httpd.conf | |
SetEnvIf X-Forwarded-Proto https HTTPS=on | |
# cat .htaccess | |
RewriteCond %{ENV:HTTPS} !=on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
RewriteEngine on | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
RewriteEngine on | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] |
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
Require all denied | |
Require ip 185.181.228.28 | |
Require ip 95.65.41.30 |
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
SetEnvIf REQUEST_URI "^/admin/" PROTECTED | |
<RequireAny> | |
<RequireAll> | |
Require not env PROTECTED | |
Require all granted | |
</RequireAll> | |
<RequireAll> | |
AuthType Basic | |
AuthName "Password Protected" | |
AuthUserFile /home/hydrosystems/public_html/admin/.htpasswd | |
Require valid-user | |
</RequireAll> | |
</RequireAny> | |
ErrorDocument 401 "Authorisation Required" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment