Skip to content

Instantly share code, notes, and snippets.

@VictorTpo
Last active October 26, 2017 08:48
Show Gist options
  • Save VictorTpo/fe5c4a180bf390a8374b15694dac7053 to your computer and use it in GitHub Desktop.
Save VictorTpo/fe5c4a180bf390a8374b15694dac7053 to your computer and use it in GitHub Desktop.

Apache config

setup

  • the certificate mywebsite-com.crt
  • the key mywebsite-com.key
  • the provider certificate aprovider-com.crt

1. copy files

scp mywebsite-com.crt user@server:/etc/ssl/[provider_name]/mywebsite-com.crt
scp mywebsite-com.key user@server:/etc/ssl/[provider_name]/mywebsite-com.key
scp aprovider-com.crt user@server:/etc/ssl/[provider_name]/aprovider-com.crt

2. VHost

cd /etc/apache2/sites-available
cp mywebsite.com.conf mywebsite.com-ssl.conf

edit it, here an exemple :

<VirtualHost *:443> # 443 for ssl, not 80
	ServerAdmin contact@mywebsite.com
	ServerName www.mywebsite.com
	ServerAlias mywebsite.com
	DocumentRoot /home/[user]/www/mywebsite/current/
	<Directory /home/[user]/www/mywebsite/current/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>
	ServerSignature Off
	
	# Not sure, but I think it have to be at the end
	# Lines order are very important
  	SSLEngine On
	SSLCertificateFile  	/etc/ssl/[provider_name]/mywebsite-com.crt
	SSLCertificateKeyFile 	/etc/ssl/[provider_name]/mywebsite-com.key
	SSLCACertificateFile 	/etc/ssl/[provider_name]/aprovider-com.crt
</VirtualHost>

3. Restart apache

a2ensite mywebsite.com-ssl
service apache2 restart

Sources :
https://www.wistee.fr/installer-ssl/apache2-mod-ssl.html

🍺

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