Last active
May 6, 2020 16:08
-
-
Save avtarnanrey/f65951517aa3a71ce13231e6a4786d1d to your computer and use it in GitHub Desktop.
Common apache config to redirect http to https and setting SSL certificate and allow .httaccess settings
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
<VirtualHost *:80> | |
Redirect "/" "https://your_website.com" | |
</VirtualHost> | |
<VirtualHost *:443> | |
ServerAdmin [email protected] | |
ServerName your_website.com | |
ServerAlias www.your_website.com | |
DocumentRoot /var/www/your_website.com | |
ErrorLog ${APACHE_LOG_DIR}/website_error.log | |
CustomLog ${APACHE_LOG_DIR}/website_access.log combined | |
SSLEngine on | |
SSLCertificateFile /etc/ssl/certs/your_website.pem | |
SSLCertificateKeyFile /etc/ssl/private/your_website.key | |
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt | |
#SSLCACertificatePath /etc/ssl/certs/ | |
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt | |
#SSLCARevocationPath /etc/apache2/ssl.crl/ | |
#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl | |
#SSLVerifyClient require | |
#SSLVerifyDepth 10 | |
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire | |
<FilesMatch "\.(cgi|shtml|phtml|php)$"> | |
SSLOptions +StdEnvVars | |
</FilesMatch> | |
<Directory /usr/lib/cgi-bin> | |
SSLOptions +StdEnvVars | |
</Directory> | |
# BrowserMatch "MSIE [2-6]" \ | |
# nokeepalive ssl-unclean-shutdown \ | |
# downgrade-1.0 force-response-1.0 | |
<Directory /var/www/your_website.com> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
Require all granted | |
</Directory> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment