documentation/tutorials/creating_ssl_certificates.html

60 lines
16 KiB
HTML

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Creating SSL Certificates | Pterodactyl</title>
<meta name="description" content="The open-source server management solution.">
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" href="/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicons/favicon-16x16.png" sizes="16x16">
<link rel="mask-icon" href="/favicons/safari-pinned-tab.svg" color="#0e4688">
<link rel="manifest" href="/favicons/manifest.json">
<link rel="shortcut icon" href="/favicons/favicon.ico">
<meta name="msapplication-config" content="/favicons/browserconfig.xml">
<meta name="theme-color" content="#0e4688">
<link rel="preload" href="/assets/css/0.styles.55a8b33d.css" as="style"><link rel="preload" href="/assets/js/app.24449253.js" as="script"><link rel="preload" href="/assets/js/49.2f6c1ad0.js" as="script"><link rel="prefetch" href="/assets/js/2.246d7148.js"><link rel="prefetch" href="/assets/js/3.9f7c152a.js"><link rel="prefetch" href="/assets/js/4.c77d3519.js"><link rel="prefetch" href="/assets/js/5.c1484b54.js"><link rel="prefetch" href="/assets/js/6.46512893.js"><link rel="prefetch" href="/assets/js/7.cb7ac953.js"><link rel="prefetch" href="/assets/js/8.b77b5e9f.js"><link rel="prefetch" href="/assets/js/9.11ff24f5.js"><link rel="prefetch" href="/assets/js/10.fc0e3859.js"><link rel="prefetch" href="/assets/js/11.7a2275fc.js"><link rel="prefetch" href="/assets/js/12.4e3316e1.js"><link rel="prefetch" href="/assets/js/13.ea7b9dae.js"><link rel="prefetch" href="/assets/js/14.a8602317.js"><link rel="prefetch" href="/assets/js/15.11bef37b.js"><link rel="prefetch" href="/assets/js/16.ed492d11.js"><link rel="prefetch" href="/assets/js/17.39b7711c.js"><link rel="prefetch" href="/assets/js/18.02120422.js"><link rel="prefetch" href="/assets/js/19.8353394f.js"><link rel="prefetch" href="/assets/js/20.fe9ea952.js"><link rel="prefetch" href="/assets/js/21.601886ac.js"><link rel="prefetch" href="/assets/js/22.ff19391b.js"><link rel="prefetch" href="/assets/js/23.c3070e00.js"><link rel="prefetch" href="/assets/js/24.40ed644e.js"><link rel="prefetch" href="/assets/js/25.8573808e.js"><link rel="prefetch" href="/assets/js/26.5b2971f2.js"><link rel="prefetch" href="/assets/js/27.d57d3226.js"><link rel="prefetch" href="/assets/js/28.a668c12e.js"><link rel="prefetch" href="/assets/js/29.1a50e21b.js"><link rel="prefetch" href="/assets/js/30.9380a536.js"><link rel="prefetch" href="/assets/js/31.0c23b9ae.js"><link rel="prefetch" href="/assets/js/32.d827cd5e.js"><link rel="prefetch" href="/assets/js/33.2572d233.js"><link rel="prefetch" href="/assets/js/34.903ba574.js"><link rel="prefetch" href="/assets/js/35.575d3104.js"><link rel="prefetch" href="/assets/js/36.a5190b64.js"><link rel="prefetch" href="/assets/js/37.7ca4d731.js"><link rel="prefetch" href="/assets/js/38.88ba14cd.js"><link rel="prefetch" href="/assets/js/39.8b57ceac.js"><link rel="prefetch" href="/assets/js/40.e09e9da8.js"><link rel="prefetch" href="/assets/js/41.cf3aab90.js"><link rel="prefetch" href="/assets/js/42.0b8e3e15.js"><link rel="prefetch" href="/assets/js/43.9bc631ac.js"><link rel="prefetch" href="/assets/js/44.303085f8.js"><link rel="prefetch" href="/assets/js/45.0f31493f.js"><link rel="prefetch" href="/assets/js/46.d91801e6.js"><link rel="prefetch" href="/assets/js/47.f99a1172.js"><link rel="prefetch" href="/assets/js/48.764dc5b7.js"><link rel="prefetch" href="/assets/js/50.5862b7bb.js"><link rel="prefetch" href="/assets/js/51.541dbbf8.js"><link rel="prefetch" href="/assets/js/52.f5ab9892.js">
<link rel="stylesheet" href="/assets/css/0.styles.55a8b33d.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="nav"><div class="sidebar-button block md:hidden flex-no-shrink"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <div class="logo-container"><a href="/" class="home-link router-link-active"><img src="/pterodactyl-flat.png" class="logo"> <span class="site-name hidden md:inline can-hide">
Pterodactyl
</span></a></div> <div class="w-full"><div class="flex"><div class="search-box"><input aria-label="Search" placeholder="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links flex-no-shrink hidden md:flex"><div class="nav-item"><a href="/project/introduction.html" class="nav-link">Documentation
</a></div><div class="nav-item"><a href="/community/about.html" class="nav-link">Community Guides
</a></div><div class="nav-item"><a href="https://pterodactyl.io/discord" target="_blank" rel="noopener noreferrer" class="nav-link external">
Get Help
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <div class="nav-item"><a href="https://github.com/pterodactyl/panel" target="_blank" rel="noopener noreferrer" class="nav-link">
Contribute
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div></nav></div></div></header> <div class="sidebar-mask"></div> <div class="sidebar"><nav class="nav-links flex-no-shrink block md:hidden"><div class="nav-item"><a href="/project/introduction.html" class="nav-link">Documentation
</a></div><div class="nav-item"><a href="/community/about.html" class="nav-link">Community Guides
</a></div><div class="nav-item"><a href="https://pterodactyl.io/discord" target="_blank" rel="noopener noreferrer" class="nav-link external">
Get Help
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <div class="nav-item"><a href="https://github.com/pterodactyl/panel" target="_blank" rel="noopener noreferrer" class="nav-link">
Contribute
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div></nav> <ul class="sidebar-links"><li><div class="sidebar-group first"><p class="sidebar-heading"><span>Project Information</span> <!----></p> <ul class="sidebar-group-items"><li><a href="/project/introduction.html" class="sidebar-link">Introduction</a></li><li><a href="/project/about.html" class="sidebar-link">About</a></li><li><a href="/project/terms.html" class="sidebar-link">Terminology</a></li><li><a href="/project/community.html" class="sidebar-link">Community Standards</a></li></ul></div></li><li><div class="sidebar-group"><p class="sidebar-heading"><span>Panel</span> <!----></p> <ul class="sidebar-group-items"><li><a href="/panel/getting_started.html" class="sidebar-link">Getting Started</a></li><li><a href="/panel/webserver_configuration.html" class="sidebar-link">Webserver Configuration</a></li><li><a href="/panel/upgrading.html" class="sidebar-link">Upgrading</a></li><li><a href="/panel/configuration.html" class="sidebar-link">Environment Configuration</a></li><li><a href="/panel/troubleshooting.html" class="sidebar-link">Troubleshooting</a></li></ul></div></li><li><div class="sidebar-group"><p class="sidebar-heading"><span>Daemon</span> <!----></p> <ul class="sidebar-group-items"><li><a href="/daemon/installing.html" class="sidebar-link">Installation</a></li><li><a href="/daemon/upgrading.html" class="sidebar-link">Upgrading</a></li><li><a href="/daemon/configuration.html" class="sidebar-link">Additional Configuration</a></li><li><a href="/daemon/kernel_modifications.html" class="sidebar-link">Kernel Modifications</a></li><li><a href="/daemon/debian_8_docker.html" class="sidebar-link">Docker on Debian 8</a></li><li><a href="/daemon/standalone_sftp.html" class="sidebar-link">Standalone SFTP Server</a></li></ul></div></li><li><div class="sidebar-group"><p class="sidebar-heading open"><span>Tutorials</span> <!----></p> <ul class="sidebar-group-items"><li><a href="/tutorials/mysql_setup.html" class="sidebar-link">Setting up MySQL</a></li><li><a href="/tutorials/creating_ssl_certificates.html" class="active sidebar-link">Creating SSL Certificates</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/tutorials/creating_ssl_certificates.html#method-1-using-certbot" class="sidebar-link">Method 1: Using Certbot</a></li><li class="sidebar-sub-header"><a href="/tutorials/creating_ssl_certificates.html#troubleshooting" class="sidebar-link">Troubleshooting</a></li></ul></li></ul></div></li><li><div class="sidebar-group collapsable"><p class="sidebar-heading"><span>Development &amp; Ops</span> <span class="arrow right"></span></p> <!----></div></li></ul> </div> <div class="page"> <div class="content"><h1 id="creating-ssl-certificates"><a href="#creating-ssl-certificates" aria-hidden="true" class="header-anchor">#</a> Creating SSL Certificates</h1> <p>This tutorial briefly covers creating new SSL certificates for your panel and daemon using LetsEncrypt™.</p> <h2 id="method-1-using-certbot"><a href="#method-1-using-certbot" aria-hidden="true" class="header-anchor">#</a> Method 1: Using Certbot</h2> <p>To begin, we will be installing certbot, a simple script that will automatically renew our certificates and allow much
cleaner creation of them. The command below is for Ubuntu distributions, but you can always check <a href="https://certbot.eff.org/" target="_blank" rel="noopener noreferrer">Certbot's official
site<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for installation instructions.</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">sudo</span> add-apt-repository ppa:certbot/certbot
<span class="token function">sudo</span> apt update
<span class="token function">sudo</span> apt <span class="token function">install</span> certbot
</code></pre></div><h3 id="creating-a-certificate"><a href="#creating-a-certificate" aria-hidden="true" class="header-anchor">#</a> Creating a Certificate</h3> <p>After installing certbot, we need to then generate a certificate. There are a couple ways to do that, but the
easiest is to have letsencrypt spin-up a temporary web-server to do this. In order for this to work, you will
first need to stop NGINX or Apache.</p> <p>Then, in the command below, you should replace <code>example.com</code> with the domain you would like to generate a certificate
for. If you have multiple domains you would like certificates for, simply add more <code>-d anotherdomain.com</code> flags to the
command. You can also look into generating a wildcard certificate but that is not covered in this tutorial.</p> <p>Once you've generated the certificate you should start NGINX or Apache again to have the certificates applied (assuming
that you've already configured the webservers to use SSL).</p> <div class="language-bash extra-class"><pre class="language-bash"><code>certbot certonly -d example.com
</code></pre></div><h3 id="auto-renewal"><a href="#auto-renewal" aria-hidden="true" class="header-anchor">#</a> Auto Renewal</h3> <p>You'll also probably want to configure automatic renewal by adding the command below to a cronjob that runs daily.
You can add the command below to that crontab. For advanced users, we suggest installing and using <a href="https://acme.sh" target="_blank" rel="noopener noreferrer">acme.sh<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>
which provides more options (see below), and is much more powerful than certbot.</p> <div class="language-text extra-class"><pre class="language-text"><code>certbot renew
</code></pre></div><h2 id="troubleshooting"><a href="#troubleshooting" aria-hidden="true" class="header-anchor">#</a> Troubleshooting</h2> <p>If you get an <code>Insecure Connection</code> or related error when trying to access your panel, it is likely that the SSL certificate has expired.
This can be easily fixed by renewing the SSL certificate, although using the command <code>certbot renew</code> won't do the job. As it'll give a error like: <code>Error: Attempting to renew cert (domain) from /etc/letsencrypt/renew/domain.conf produced an unexpected error</code>.
This will happen especially if you're running NGINX instead of Apache. The solution for this is to stop NGINX, then renew the certificate, finally restart NGINX.</p> <p>Stop NGINX:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>systemctl stop nginx
</code></pre></div><p>Renew the certificate:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>certbot renew
</code></pre></div><p>Once the process has complete, you can restart the NGINX service:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>systemctl start nginx
</code></pre></div></div> <div class="page-edit"><div class="edit-link"><a href="https://github.com/pterodactyl/documentation/edit/master/tutorials/creating_ssl_certificates.md" target="_blank" rel="noopener noreferrer">Help us improve this page.</a> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></div> <!----></div> <div class="page-nav"><p class="inner"></p> <div class="prev"><span>
<a href="/tutorials/mysql_setup.html">Setting up MySQL</a></span></div> <div class="next"><span><a href="/ops/publish_release.html">Publishing a Release</a>
</span></div></div> </div></div></div>
<script src="/assets/js/49.2f6c1ad0.js" defer></script><script src="/assets/js/app.24449253.js" defer></script>
</body>
</html>