{"id":66,"date":"2016-04-24T12:26:29","date_gmt":"2016-04-24T17:26:29","guid":{"rendered":"https:\/\/servertricks.com\/?p=66"},"modified":"2016-05-08T16:06:03","modified_gmt":"2016-05-08T21:06:03","slug":"enable-https-on-apache","status":"publish","type":"post","link":"https:\/\/servertricks.com\/index.php\/2016\/04\/24\/enable-https-on-apache\/","title":{"rendered":"Enable HTTPS on Apache"},"content":{"rendered":"<p>This can be quite a nightmare with a new apache install without a guide. I have struggled a few times with getting it setup correctly, especially with &#8220;Letsencrypt.&#8221;<\/p>\n<p>Assuming apache is already installed and working run the following<\/p>\n<p><code>$ sudo make-ssl-cert generate-default-snakeoil --force-overwrite<br \/>\n$ sudo a2enmod ssl<br \/>\n$ sudo service apache2 restart<\/code><\/p>\n<p>SSL is now enabled, now to create your first site. First create your website document root under \/var\/www<\/p>\n<p><code>$ cd \/var\/www<br \/>\n$ sudo mkdir example.com<\/code><\/p>\n<p>Now browse to sites-available and create the .conf file.<\/p>\n<p><code>$ cd \/etc\/apache2\/sites-available<br \/>\n$ sudo nano example.com.conf<\/code><\/p>\n<p>Copy and paste this template into the file and modify to fit your domain name<\/p>\n<pre>&lt;VirtualHost *:80&gt;\r\n ServerName example.com\r\n DocumentRoot \/var\/www\/example.com\r\n ErrorLog \/var\/log\/apache2\/error.log\r\n CustomLog \/var\/log\/apache2\/access.log combined\r\n&lt;\/VirtualHost&gt;<\/pre>\n<p>The last step is to run a2ensite to create the SSL entry for your new site and restart apache.<\/p>\n<p><code>$ sudo a2ensite example.com<br \/>\n$ sudo service apache2 reload<\/code><\/p>\n<p>Now proceed on to the &#8220;Letsencrypt&#8221; tutorial for some free SSL certs!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This can be quite a nightmare with a new apache install without a guide. I have struggled a few times with getting it setup correctly, especially with &#8220;Letsencrypt.&#8221; Assuming apache is already installed and working run the following $ sudo make-ssl-cert generate-default-snakeoil &#8211;force-overwrite $ sudo a2enmod ssl $ sudo service apache2 restart SSL is now [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[10],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-ubuntu","tag-16-04"],"_links":{"self":[{"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":9,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":174,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/posts\/66\/revisions\/174"}],"wp:attachment":[{"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}