<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/default.xsl"?>
<fr:tree xmlns:fr="http://www.forester-notes.org" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" root="false" base-url="/">
  <fr:frontmatter>
    <fr:authors>
      <fr:author>
        <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
      </fr:author>
    </fr:authors>
    <fr:date>
      <fr:year>2018</fr:year>
      <fr:month>6</fr:month>
      <fr:day>7</fr:day>
    </fr:date>
    <fr:date>
      <fr:year>2023</fr:year>
      <fr:month>8</fr:month>
      <fr:day>1</fr:day>
    </fr:date>
    <fr:date>
      <fr:year>2025</fr:year>
      <fr:month>7</fr:month>
      <fr:day>23</fr:day>
    </fr:date>
    <fr:uri>https://xw.is/001I/</fr:uri>
    <fr:display-uri>001I</fr:display-uri>
    <fr:route>/001I/</fr:route>
    <fr:title text="Miscellaneous › TLS Certificates Primer"><fr:link href="/misc-index/" title="Miscellaneous" uri="https://xw.is/misc-index/" display-uri="misc-index" type="local">Miscellaneous</fr:link> › TLS Certificates Primer</fr:title>
  </fr:frontmatter>
  <fr:mainmatter>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2023</fr:year>
          <fr:month>8</fr:month>
          <fr:day>1</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>23</fr:day>
        </fr:date>
        <fr:title text="Prerequisites">Prerequisites</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>You will need to generate a <html:em>private key</html:em> and a <html:em>certificate signing request</html:em>.</html:p>
        <html:pre>DOMAIN=xw.is
openssl req -new -newkey rsa:2048 -nodes -keyout $DOMAIN.key -out $DOMAIN.csr</html:pre>
        <html:p>Send <html:code>xw.is.csr</html:code> to your certificate vendor and follow the instructions.</html:p>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2023</fr:year>
          <fr:month>8</fr:month>
          <fr:day>1</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>23</fr:day>
        </fr:date>
        <fr:title text="Prepare certificates for use">Prepare certificates for use</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>Your certificate vendor will give you a bunch of files. You need to concatenate them in order to use them in your web server. Order is essential. For example, for <fr:link href="https://www.digicert.com/" type="external">DigiCert</fr:link>:</html:p>
        <html:pre>cat xw_is.crt DigiCertCA.crt TrustedRoot.crt &gt;xw.is.crt</html:pre>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2023</fr:year>
          <fr:month>8</fr:month>
          <fr:day>1</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>23</fr:day>
        </fr:date>
        <fr:title text="Configure your web server">Configure your web server</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>Use <html:code>xw.is.key</html:code> and <html:code>xw.is.crt</html:code> in your web server. For example for nginx add this to your server block:</html:p>
        <html:pre>
worker_processes 1;

events {
    worker_connections  1024;
}

http {
    server {
        listen 443;
        server_name xw.is;

        <html:strong>ssl on;
        ssl_certificate /tank/nginx/tls/xw.is.crt;
        ssl_certificate_key /tank/nginx/tls/xw.is.key;</html:strong>
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout 5m;

        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        location / {
            root /usr/local/www/nginx;
            index index.html index.htm;
        }
    }
}</html:pre>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2023</fr:year>
          <fr:month>8</fr:month>
          <fr:day>1</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>23</fr:day>
        </fr:date>
        <fr:title text="Alternatives">Alternatives</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>Alternativelly, you might want to use <fr:link href="https://letsencrypt.org/" type="external">Let's Encrypt</fr:link>.</html:p>
      </fr:mainmatter>
    </fr:tree>
  </fr:mainmatter>
  <fr:backmatter>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="References">References</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Context">Context</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Backlinks">Backlinks</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Related">Related</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Contributions">Contributions</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
  </fr:backmatter>
</fr:tree>
