title: How can I implement SSL HTTPS on XAMPP Ubuntu 18.04
body: <p>Currently I've installed my <code>LaravelAPP</code> on ubuntu <code>18.04</code> LTS (docker instance)</p>
  
  <ol>
  <li>In this <code>path: /opt/lampp/htdocs/api_tk</code></li>
  <li>In my <code>/opt/lampp/etc/extra/httpd-vhosts.conf</code> I have this working setup without <code>SSL enabled</code></li>
  </ol>
  
  <p><em>PORT: 3021 is used for docker as port 80</em></p>
  
  <pre><code>&lt;VirtualHost *:3021&gt;
  DocumentRoot "/opt/lampp/htdocs/api_tk/public"
  ServerName myapi.domain.com
  ServerAlias myapi.domain.com
  
  ErrorLog "logs/API-error_log"
  CustomLog "logs/API-access_log" common
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <ol start="3">
  <li><p>And this setup is working fine I can use my <code>laravel api</code> very well.</p></li>
  <li><p>After this setup I tried to generate <code>CSR</code> on my docker instance with a name of <code>request_myapi.csr</code></p></li>
  <li><p>So I tried to generate also a private key with a name of <code>private.key</code></p></li>
  <li><p><code>private.key</code> is encrypted with something like this</p>
  
  <pre><code>-----BEGIN RSA PRIVATE KEY-----
  Proc-Type: 4,ENCRYPTED
  DEK-Info: DES-EDE3-CBC,0C7820F5FAA4FF26
  
  Sometext.............
  
  -----END RSA PRIVATE KEY-----
  </code></pre></li>
  <li><p>So I tried to decrypt and I named it as <code>private_new.key</code>. This looks like:</p>
  
  <pre><code> -----BEGIN RSA PRIVATE KEY-----
  
   Some text....       
  
   -----END RSA PRIVATE KEY-----
  </code></pre></li>
  <li><p>The <code>csr</code> that I created was used to generate my <code>crt</code> files like this</p>
  
  <p>located at : <code>/opt/lampp/htdocs/ssl_key</code></p>
  
  <ul>
  <li>myapi-bundle.crt</li>
  <li>myapi.crt</li>
  <li><p>myapi.pem</p>
  
  <ol start="9">
  <li>So I tried to use this site to check if my <code>private_new.key</code> and <code>myapi.crt</code> is matched.</li>
  </ol></li>
  </ul></li>
  </ol>
  
  <p><a href="https://www.sslshopper.com/certificate-key-matcher.html" rel="nofollow noreferrer">https://www.sslshopper.com/certificate-key-matcher.html</a></p>
  
  <p><a href="https://i.stack.imgur.com/GiG0f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GiG0f.png" alt="enter image description here"></a></p>
  
  <ol start="10">
  <li>So I updated my <code>httpd-vhosts.conf</code> </li>
  </ol>
  
  <p>with ssl enabled</p>
  
  <pre><code>&lt;VirtualHost *:3021&gt;
  DocumentRoot "/opt/lampp/htdocs/api_tk/public"
  &lt;Directory "/opt/lampp/htdocs/api_tk/public"&gt;
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
  &lt;/Directory&gt;
  ServerName myapi.domain.com
  ServerAlias myapi.domain.com
  
  ErrorLog "logs/API-error_log"
  
  SSLEngine on
  SSLCertificateFile "/opt/lampp/htdocs/ssl_key/myapi.crt"
  SSLCertificateKeyFile "/opt/lampp/htdocs/ssl_key/private_new.key"
  SSLCACertificateFile "/opt/lampp/htdocs/ssl_key/myapi-bundle.crt"
  Redirect permanent / https://myapi.domain.com
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <ol start="11">
  <li>and restart my xampp using this command <code>sudo /opt/lampp/lampp restart</code></li>
  </ol>
  
  <p>and gives me something like this</p>
  
  <p><a href="https://i.stack.imgur.com/PtD5L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PtD5L.png" alt="enter image description here"></a></p>
  
  <p>Seems like there's nothing wrong with my setup because it restarted properly and with ok status. </p>
  
  <p><strong>12. So I tried to check if the <code>api</code> is ssl enabled already but seems like it didn't work is there anywrong with my setup?</strong></p>
  
  <p><em>Note: I already done with my laravel https setup like : routes &amp; resources(css and js)</em></p>
  
  <p>Main Error: <strong>refused to connect.</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ifU1m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ifU1m.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/OA7Nh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OA7Nh.png" alt="enter image description here"></a></p>