Skip to content

Instantly share code, notes, and snippets.

@sergioska
Last active June 28, 2018 09:02
Show Gist options
  • Save sergioska/95b20f23306031fe5844201a0d7b493a to your computer and use it in GitHub Desktop.
Save sergioska/95b20f23306031fe5844201a0d7b493a to your computer and use it in GitHub Desktop.
https apache2
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "/etc/ssl/ssl_certificate.crt"
SSLCertificateKeyFile "/etc/ssl/ssl_certificate.key"
SSLCACertificateFile "/etc/ssl/ssl_certificate.ca-bundle"
ServerAdmin admin@mysite.com
DocumentRoot /var/www/html/mysite
ServerName www.mysite.com
ServerAlias www.mysite.com
ErrorLog logs/ssl.mysite.com-error_log
CustomLog logs/ssl.mysite.com-access_log common
RewriteEngine On
# redirect no www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^\/?(.*)$ https://www.mysite.com/$1 [R=301,L]
<Directory "/var/www/html/mysite">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
AddDefaultCharset UTF-8
AddType application/vnd.ms-fontobject eot
AddType font/opentype otf
AddType font/truetype ttf
AddType application/x-font-woff woff
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/mysite
ServerName www.mysite.com
ServerAlias mysite.com
Redirect permanent / https://www.mysite.com/
ErrorLog /var/log/httpd/www.mysite.com-error_log
CustomLog /var/log/httpd/www.mysite.com-access_log common
<Directory "/var/www/html/mysite">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
@sergioska
Copy link
Author

sergioska commented Jun 28, 2018

VirtualHost per configurazione https apache2.
Post completo al link qua sotto:
http://www.comemonetizzo.it/passare-da-http-a-https-apache2/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment