Last active
October 15, 2018 11:07
-
-
Save aseredenko/5a00aafded59129debab27821874c9e4 to your computer and use it in GitHub Desktop.
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
Define SITE sitename.com | |
Define NAME sitename | |
<VirtualHost *:80> | |
ServerName ${SITE} | |
ServerAlias www.${SITE} | |
ServerAdmin webmaster@localhost | |
DocumentRoot /home/deploy/sites/${NAME}/web | |
ErrorLog ${APACHE_LOG_DIR}/${SITE}.error.log | |
CustomLog ${APACHE_LOG_DIR}/${SITE}.log combined | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
</VirtualHost> | |
<VirtualHost *:443> | |
ServerName ${SITE} | |
ServerAlias www.${SITE} | |
ServerAdmin webmaster@localhost | |
DocumentRoot /home/deploy/sites/${NAME}/web | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST}s !^www\. [NC] | |
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
ErrorLog ${APACHE_LOG_DIR}/${SITE}.error.log | |
CustomLog ${APACHE_LOG_DIR}/${SITE}.access.log combined | |
SSLEngine On | |
SSLCertificateFile /etc/apache2/ssl/www_${NAME}_com.crt | |
SSLCertificateKeyFile /etc/apache2/ssl/${NAME}.com.key | |
SSLCertificateChainFile /etc/apache2/ssl/www_${NAME}_com.ca-bundle | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment