<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>certbot &#8211; Sandy Scott&#039;s Web Spot</title>
	<atom:link href="https://www.sandyscott.net/tag/certbot/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sandyscott.net</link>
	<description>My little corner of the web</description>
	<lastBuildDate>Fri, 05 Jun 2020 11:37:03 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>Server Setup 9: Nextcloud Prep</title>
		<link>https://www.sandyscott.net/2020/05/server-setup-9-nextcloud-prep/</link>
					<comments>https://www.sandyscott.net/2020/05/server-setup-9-nextcloud-prep/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Thu, 21 May 2020 21:22:16 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[certbot]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nextcloud]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=564</guid>

					<description><![CDATA[First, we need 1 extra PHP module: Like with WordPress, we&#8217;ll create a folder and apache configuration for Nextcloud: And we&#8217;ll use essentially the same apache configuration we used for wordpress, with a few tweaks. We&#8217;ll also create a temporary configuration for collabora while we&#8217;re here: This is just a...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/server-setup-9-nextcloud-prep/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>First, we need 1 extra PHP module:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install php-gd</pre></div>



<p>Like with WordPress, we&#8217;ll create a folder and apache configuration for Nextcloud:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd /var/www
sudo mkdir nextcloud
sudoedit /etc/apache2/sites-available/nextcloud.conf</pre></div>



<p>And we&#8217;ll use essentially the same apache configuration we used for wordpress, with a few tweaks.</p>



<pre class="wp-block-code"><code>&lt;VirtualHost *:80>
    ServerName nextcloud.example.org
    DocumentRoot /var/www/nextcloud
    
    &lt;Directory /var/www/nextcloud/>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews

        &lt;IfModule mod_dav.c>
            Dav off
        &lt;/IfModule>
    &lt;/Directory>

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
&lt;/VirtualHost></code></pre>



<p>We&#8217;ll also create a temporary configuration for collabora while we&#8217;re here:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/collabora.conf</pre></div>



<pre class="wp-block-code"><code>&lt;VirtualHost *:80>
    ServerName collabora.example.org
    ErrorLog ${APACHE_LOG_DIR}/collabora_error.log
    CustomLog ${APACHE_LOG_DIR}/collabora_access.log combined
&lt;/VirtualHost></code></pre>



<p>This is just a barebones template that&#8217;s just enough to let us set up HTTPS later.</p>



<p>Enable the sites and reload apache:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo a2ensite nextcloud collabora
sudo systemctl reload apache2</pre></div>



<h2 class="wp-block-heading">DNS</h2>



<p>We need to create DNS Entries for Nextcloud and Collabora:</p>



<ol class="wp-block-list"><li>Log into the control panel for your domain.</li><li>Create a <strong>CNAME </strong>record<ul><li>Domain: e.g. <strong>nextcloud.example.org</strong></li><li>Data: e.g. <strong>example.org</strong> if you had a fixed IP, or the dynamic DNS server address you created e.g. <strong><strong>anotherexample.ddns.net</strong></strong></li></ul></li><li>Do the exact same for <strong>collabora.example.org</strong></li></ol>



<h2 class="wp-block-heading">HTTPS</h2>



<p>Use certbot again to enable https on both <strong>nextcloud.example.org</strong> and <strong>collabora.example.org</strong></p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo certbot --apache</pre></div>



<p>When it asks you which sites you want to activate HTTPS for, you can select multiple options by putting a comma separated list. You can also choose to allow certbot to automatically reconfigure apache to <strong>Redirect</strong> (option 2 when it asks you).</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/server-setup-9-nextcloud-prep/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 5: HTTPS</title>
		<link>https://www.sandyscott.net/2020/05/server-setup-5-https/</link>
					<comments>https://www.sandyscott.net/2020/05/server-setup-5-https/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Thu, 21 May 2020 10:29:38 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[certbot]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[Lets Encrypt]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=519</guid>

					<description><![CDATA[Secure websites have become the norm for almost everything. They protect your privacy when viewing public information, and are an essential security component with any website you need to log into &#8211; without it, an attacker might be able to snoop on your password, or any information the website sends...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/server-setup-5-https/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>Secure websites have become the norm for almost everything. They protect your privacy when viewing public information, and are an essential security component with any website you need to log into &#8211; without it, an attacker might be able to snoop on your password, or any information the website sends back to you.</p>



<p>To make your website secure, you need an SSL certificate. Until quite recently, this cost a few tens of dollars a year. Fortunately Lets Encrypt has popped up and started providing free SSL certificates. Even better than that, there&#8217;s a free piece of software which almost completely automates the process of getting and installing the certificate.</p>



<p>The software is called certbot, lets download it (along with a plugin to play nicely with Apache):</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install certbot python-certbot-apache</pre></div>



<p>We&#8217;ll run it, and allow it to modify our apache configuration:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudo certbot --apacheShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo certbot --apache</pre></div>



<p>It&#8217;s an interactive program, so read and follow the prompts. I&#8217;d select option 1 when asked about whether to redirect HTTP traffic to HTTPS &#8211; we&#8217;ll do that after checking it&#8217;s working.</p>



<pre class="wp-block-code"><code>sandy@waldorf:~$ sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): webmaster@example.org

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https:&#47;&#47;acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: a

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: n

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: test.example.org
2: www.example.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 2
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for www.example.org
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/wordpress-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/wordpress-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/wordpress-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number &#91;1-2] then &#91;enter] (press 'c' to cancel): 1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://www.example.org

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=www.example.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/www.example.org/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/www.example.org/privkey.pem
   Your cert will expire on 2020-08-19. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

</code></pre>



<h2 class="wp-block-heading">Test &amp; compare</h2>



<p>Now you should be able to to go to the secure version of your website &#8211; put <strong>https://</strong> in front of the domain name (instead of <strong>http://</strong>). There should now be a padlock icon to the next to the domain name, and before there was something saying &#8220;Not secure&#8221; or a broken padlock icon, or just nothing. The screenshots are from Firefox on Windows 10, your client system might look different.</p>



<p>Insecure:</p>



<figure class="wp-block-image size-full is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-21.png"><img fetchpriority="high" decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-21.png" alt="" class="wp-image-525" width="381" height="181" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-21.png 381w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-21-300x143.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-21-150x71.png 150w" sizes="(max-width: 381px) 100vw, 381px" /></a><figcaption>Insecure version of the website</figcaption></figure>



<p>Secure:</p>



<figure class="wp-block-image size-full is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-22.png"><img decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-22.png" alt="" class="wp-image-526" width="381" height="181" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-22.png 381w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-22-300x143.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-22-150x71.png 150w" sizes="(max-width: 381px) 100vw, 381px" /></a></figure>



<p>You should be able click on the padlock and see more information, including the expiry date. One thing to be aware of if you have Antivirus (AV) software on your computer &#8211; some  products intercept secure traffic so they can scan it for viruses. Unfortunately that means you&#8217;ll see the name of your Antivirus vendor in the certificate information, instead of <strong>Lets Encrypt</strong>. This isn&#8217;t a problem, just something to be aware of. You can try disabling this feature in your AV software (refer to their documentation), or try on a different device, like a phone. Have a look for the expiry date and make a note it &#8211; it should be 90 days in the future. Certbot should automatically renew the certificates well in advance, but you can check a few days before the expiry to make sure that&#8217;s happened.</p>



<h2 class="wp-block-heading">Redirect to HTTPS</h2>



<p>So what did  certbot change in our apache configuration? let&#8217;s have a look:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">ls /etc/apache2/sites-enabled/</pre></div>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sandy@pops:~$ ls /etc/apache2/sites-enabled/
test.conf  wordpress.conf  wordpress-le-ssl.conf</pre></div>



<p>The <code>wordpress-le-ssl.conf</code> file is new, so lets look at that</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cat /etc/apache2/sites-available/wordpress-le-ssl.conf</pre></div>



<pre class="wp-block-code"><code>&lt;IfModule mod_ssl.c>
&lt;VirtualHost *:443>
        ServerName  www.example.org

        DocumentRoot /var/www/wordpress

        ErrorLog ${APACHE_LOG_DIR}/wordpress_error.log
        CustomLog ${APACHE_LOG_DIR}/wordpress_access.log combined


SSLCertificateFile /etc/letsencrypt/live/sandyscott.ddns.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/sandyscott.ddns.net/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
&lt;/VirtualHost>
&lt;/IfModule></code></pre>



<p>It&#8217;s almost identical to original we created, with a few key differences:</p>



<ul class="wp-block-list"><li>The <code>&lt;IfModule mod_ssl.c\&gt;...&lt;/IfModule&gt;</code> wrapper around the whole thing just stops apache from failing if the ssl module isn&#8217;t loaded. We could remove this without any problems because we know SSL is working.</li><li>The <code>&lt;Virtual Host *:443&gt;</code> line has 443 instead of 80 in it. This is the port number the site reacts to.</li><li>The two lines beginning with <code>SSLCertificateFile</code> and <code>SSLCertificateKeyFile</code> are new. These tell apache where to find the certificates.</li><li>The <code>Include </code>line loads another configuration file with additional security options.</li></ul>



<p>Now we&#8217;ll modify the http (insecure) configuration to automatically redirect to the https (secure) site.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudoShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/wordpress.conf</pre></div>



<p>Change it to:</p>



<pre class="wp-block-code"><code>&lt;VirtualHost *:80>
	ServerName www.example.org
	Redirect permanent / https://www.example.org/
&lt;/VirtualHost></code></pre>



<p>This means that anyone that tries to go to http://www.example.org will get an answer back from apache saying &#8220;it isn&#8217;t here any more, go to http<strong><span style="text-decoration: underline;">s</span></strong>://www.example.org&#8221;. The <code>permanent </code>bit means that the client browser will remember that, and go straight for the secure site every time.</p>



<p>Reload the apache configuration:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo systemctl reload apache2</pre></div>



<p>Now try to go to the http version of your website &#8211; it should automatically send you to the https version with the padlock.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/server-setup-5-https/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
