documentation/panel/1.0/webserver_configuration.html

331 lines
34 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Webserver Configuration | Pterodactyl</title>
<meta name="generator" content="VuePress 1.8.2">
<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/site.webmanifest">
<link rel="shortcut icon" href="/favicons/favicon.ico">
<meta name="description" content="Pterodactyl is an open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.">
<meta name="msapplication-config" content="/favicons/browserconfig.xml">
<meta name="theme-color" content="#0e4688">
<link rel="preload" href="/assets/css/0.styles.b3d0dfa6.css" as="style"><link rel="preload" href="/assets/js/app.f2945e27.js" as="script"><link rel="preload" href="/assets/js/4.166b9bf8.js" as="script"><link rel="preload" href="/assets/js/1.19e16341.js" as="script"><link rel="preload" href="/assets/js/68.ae40e5e7.js" as="script"><link rel="prefetch" href="/assets/js/10.cdd4a61d.js"><link rel="prefetch" href="/assets/js/11.edf57bce.js"><link rel="prefetch" href="/assets/js/12.08b142d8.js"><link rel="prefetch" href="/assets/js/13.bd04c4ec.js"><link rel="prefetch" href="/assets/js/14.d448db4e.js"><link rel="prefetch" href="/assets/js/15.e88515bc.js"><link rel="prefetch" href="/assets/js/16.24317aa9.js"><link rel="prefetch" href="/assets/js/17.99a727ea.js"><link rel="prefetch" href="/assets/js/18.fcb158a9.js"><link rel="prefetch" href="/assets/js/19.5c29a0ca.js"><link rel="prefetch" href="/assets/js/2.21e1a937.js"><link rel="prefetch" href="/assets/js/20.e4bdca81.js"><link rel="prefetch" href="/assets/js/21.69bb49e0.js"><link rel="prefetch" href="/assets/js/22.f9353e9f.js"><link rel="prefetch" href="/assets/js/23.2e2e0abb.js"><link rel="prefetch" href="/assets/js/24.cef1e6d4.js"><link rel="prefetch" href="/assets/js/25.0d90b696.js"><link rel="prefetch" href="/assets/js/26.199e42e5.js"><link rel="prefetch" href="/assets/js/27.53b2955f.js"><link rel="prefetch" href="/assets/js/28.b1cca863.js"><link rel="prefetch" href="/assets/js/29.34880c0e.js"><link rel="prefetch" href="/assets/js/30.6cc47499.js"><link rel="prefetch" href="/assets/js/31.d561e4f4.js"><link rel="prefetch" href="/assets/js/32.5ec9cc12.js"><link rel="prefetch" href="/assets/js/33.8f006b9e.js"><link rel="prefetch" href="/assets/js/34.08d0de59.js"><link rel="prefetch" href="/assets/js/35.226da989.js"><link rel="prefetch" href="/assets/js/36.26c44a85.js"><link rel="prefetch" href="/assets/js/37.bb650e96.js"><link rel="prefetch" href="/assets/js/38.8014c1ae.js"><link rel="prefetch" href="/assets/js/39.d1e0976c.js"><link rel="prefetch" href="/assets/js/40.6726a903.js"><link rel="prefetch" href="/assets/js/41.e352cd67.js"><link rel="prefetch" href="/assets/js/42.42b795d0.js"><link rel="prefetch" href="/assets/js/43.87824034.js"><link rel="prefetch" href="/assets/js/44.73bec5d3.js"><link rel="prefetch" href="/assets/js/45.d370a0c3.js"><link rel="prefetch" href="/assets/js/46.7e0f2b72.js"><link rel="prefetch" href="/assets/js/47.b8b05e62.js"><link rel="prefetch" href="/assets/js/48.bddaa49b.js"><link rel="prefetch" href="/assets/js/49.3bc646ce.js"><link rel="prefetch" href="/assets/js/5.2366f5e0.js"><link rel="prefetch" href="/assets/js/50.b21452cd.js"><link rel="prefetch" href="/assets/js/51.44a25af8.js"><link rel="prefetch" href="/assets/js/52.c69a9cce.js"><link rel="prefetch" href="/assets/js/53.2cf7d527.js"><link rel="prefetch" href="/assets/js/54.a806efe3.js"><link rel="prefetch" href="/assets/js/55.3ff57f8d.js"><link rel="prefetch" href="/assets/js/56.0431282b.js"><link rel="prefetch" href="/assets/js/57.fdfaf056.js"><link rel="prefetch" href="/assets/js/58.9cc1b910.js"><link rel="prefetch" href="/assets/js/59.0bbceca9.js"><link rel="prefetch" href="/assets/js/6.92501184.js"><link rel="prefetch" href="/assets/js/60.02ba8c2d.js"><link rel="prefetch" href="/assets/js/61.e1b2bc1e.js"><link rel="prefetch" href="/assets/js/62.b082266a.js"><link rel="prefetch" href="/assets/js/63.30dbbed7.js"><link rel="prefetch" href="/assets/js/64.4ee3782b.js"><link rel="prefetch" href="/assets/js/65.8abdf088.js"><link rel="prefetch" href="/assets/js/66.db520d3d.js"><link rel="prefetch" href="/assets/js/67.45d379df.js"><link rel="prefetch" href="/assets/js/69.03eebd32.js"><link rel="prefetch" href="/assets/js/7.c41300e2.js"><link rel="prefetch" href="/assets/js/70.3ecf8a31.js"><link rel="prefetch" href="/assets/js/71.6b549e82.js"><link rel="prefetch" href="/assets/js/72.a824f4b4.js"><link rel="prefetch" href="/assets/js/73.bcb8dfe0.js"><link rel="prefetch" href="/assets/js/74.7f4bdb91.js"><link rel="prefetch" href="/assets/js/75.b97c5e9c.js"><link rel="prefetch" href="/assets/js/8.324a951f.js"><link rel="prefetch" href="/assets/js/9.28a16f41.js">
<link rel="stylesheet" href="/assets/css/0.styles.b3d0dfa6.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div><div class="theme-container mt-12"><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="/logos/pterry.svg" 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://discord.gg/pterodactyl" target="_blank" rel="noopener noreferrer" class="nav-link external">
Get Help
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="https://dashflo.net/docs/api/pterodactyl/v1/" target="_blank" rel="noopener noreferrer" class="nav-link external">
API
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></a></div> <div class="nav-item"><a href="https://github.com/pterodactyl/panel" target="_blank" rel="noopener noreferrer" class="nav-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></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://discord.gg/pterodactyl" target="_blank" rel="noopener noreferrer" class="nav-link external">
Get Help
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="https://dashflo.net/docs/api/pterodactyl/v1/" target="_blank" rel="noopener noreferrer" class="nav-link external">
API
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></a></div> <div class="nav-item"><a href="https://github.com/pterodactyl/panel" target="_blank" rel="noopener noreferrer" class="nav-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></a></div></nav> <ul class="sidebar-links"><li><div class="sidebar-group first"><p class="sidebar-heading open"><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> <!----> <div tabindex="0" class="version-select custom-select float-right"><div class="selected"><div class="inline-block">
1.11
<span class="rounded-full ml-2 text-green-dark">current</span></div> <span class="arrow"></span></div> <div class="items hidden"><div class="item"><div class="inline-block">
1.11
<span class="rounded-full ml-2 text-green-dark">current</span></div></div></div></div></p> <ul class="sidebar-group-items"><li><a href="/panel/1.0/getting_started.html" class="sidebar-link">Getting Started</a></li><li><a href="/panel/1.0/webserver_configuration.html" aria-current="page" class="active sidebar-link">Webserver Configuration</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/panel/1.0/additional_configuration.html" class="sidebar-link">Additional Configuration</a></li><li><a href="/panel/1.0/updating.html" class="sidebar-link">Updating the Panel</a></li><li><a href="/panel/1.0/troubleshooting.html" class="sidebar-link">Troubleshooting</a></li><li><a href="/panel/1.0/legacy_upgrade.html" class="sidebar-link">Legacy Upgrades</a></li></ul></div></li><li><div class="sidebar-group"><p class="sidebar-heading"><span>Wings</span> <!----> <div tabindex="0" class="version-select custom-select float-right"><div class="selected"><div class="inline-block">
1.11
<span class="rounded-full ml-2 text-green-dark">current</span></div> <span class="arrow"></span></div> <div class="items hidden"><div class="item"><div class="inline-block">
1.11
<span class="rounded-full ml-2 text-green-dark">current</span></div></div></div></div></p> <ul class="sidebar-group-items"><li><a href="/wings/1.0/installing.html" class="sidebar-link">Installing Wings</a></li><li><a href="/wings/1.0/upgrading.html" class="sidebar-link">Upgrading Wings</a></li><li><a href="/wings/1.0/migrating.html" class="sidebar-link">Migrating to Wings</a></li><li><a href="/wings/1.0/configuration.html" class="sidebar-link">Additional Configuration</a></li></ul></div></li><li><div class="sidebar-group"><p class="sidebar-heading"><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="sidebar-link">Creating SSL Certificates</a></li></ul></div></li><li><div class="sidebar-group"><p class="sidebar-heading"><span>Guides</span> <!----> <!----></p> <ul class="sidebar-group-items"><li><a href="/guides/mounts.html" class="sidebar-link">Using Mounts</a></li></ul></div></li></ul> </div> <div class="page"> <div class="content content__default"><h1 id="webserver-configuration"><a href="#webserver-configuration" class="header-anchor">#</a> Webserver Configuration</h1> <div class="custom-block warning"><p class="custom-block-title">WARNING</p> <p>When using the SSL configuration you MUST create SSL certificates, otherwise your webserver will fail to start. See the <a href="/tutorials/creating_ssl_certificates.html">Creating SSL Certificates</a> documentation page to learn how to create these certificates before continuing.</p></div> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>If you are using <a href="#caddy-with-automatic-ssl">Caddy With Automatic SSL</a>, you do not have to create SSL certificates manually, Caddy will take care of it automatically.</p></div> <div class="tabs-component"><ul role="tablist" class="tabs-component-tabs"></ul> <div class="tabs-component-panels"><section aria-hidden="true" id="nginx-with-ssl" role="tabpanel" class="tabs-component-panel" style="display:none;"><p>First, remove the default NGINX configuration.</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">rm</span> /etc/nginx/sites-enabled/default
</code></pre></div><p>Now, you should paste the contents of the file below, replacing <code>&lt;domain&gt;</code> with your domain name being used in a file called
<code>pterodactyl.conf</code> and place the file in <code>/etc/nginx/sites-available/</code>, or — if on CentOS, <code>/etc/nginx/conf.d/</code>.</p> <div class="language-conf extra-class"><div class="highlight-lines"><br><br><br><br><div class="highlighted"> </div><br><br><br><br><br><div class="highlighted"> </div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><div class="highlighted"> </div><div class="highlighted"> </div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div><pre class="language-text"><code>server_tokens off;
server {
listen 80;
server_name &lt;domain&gt;;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name &lt;domain&gt;;
root /var/www/pterodactyl/public;
index index.php;
access_log /var/log/nginx/pterodactyl.app-access.log;
error_log /var/log/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes
client_max_body_size 100m;
client_body_timeout 120s;
sendfile off;
# SSL Configuration - Replace the example &lt;domain&gt; with your domain
ssl_certificate /etc/letsencrypt/live/&lt;domain&gt;/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/&lt;domain&gt;/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers &quot;ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384&quot;;
ssl_prefer_server_ciphers on;
# See https://hstspreload.org/ before uncommenting the line below.
# add_header Strict-Transport-Security &quot;max-age=15768000; preload;&quot;;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection &quot;1; mode=block&quot;;
add_header X-Robots-Tag none;
add_header Content-Security-Policy &quot;frame-ancestors 'self'&quot;;
add_header X-Frame-Options DENY;
add_header Referrer-Policy same-origin;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param PHP_VALUE &quot;upload_max_filesize = 100M \n post_max_size=100M&quot;;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY &quot;&quot;;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
include /etc/nginx/fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
</code></pre></div><h3 id="enabling-configuration"><a href="#enabling-configuration" class="header-anchor">#</a> Enabling Configuration</h3> <p>The final step is to enable your NGINX configuration and restart it.</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># You do not need to symlink this file if you are using CentOS.</span>
<span class="token function">sudo</span> <span class="token function">ln</span> -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf
<span class="token comment"># You need to restart nginx regardless of OS.</span>
<span class="token function">sudo</span> systemctl restart nginx
</code></pre></div></section> <section aria-hidden="true" id="nginx-without-ssl" role="tabpanel" class="tabs-component-panel" style="display:none;"><p>First, remove the default NGINX configuration.</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">rm</span> /etc/nginx/sites-enabled/default
</code></pre></div><p>Now, you should paste the contents of the file below, replacing <code>&lt;domain&gt;</code> with your domain name being used in a file called
<code>pterodactyl.conf</code> and place the file in <code>/etc/nginx/sites-available/</code>, or — if on CentOS, <code>/etc/nginx/conf.d/</code>.</p> <div class="language-conf extra-class"><div class="highlight-lines"><br><br><br><div class="highlighted"> </div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div><pre class="language-text"><code>server {
# Replace the example &lt;domain&gt; with your domain name or IP address
listen 80;
server_name &lt;domain&gt;;
root /var/www/pterodactyl/public;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes
client_max_body_size 100m;
client_body_timeout 120s;
sendfile off;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param PHP_VALUE &quot;upload_max_filesize = 100M \n post_max_size=100M&quot;;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY &quot;&quot;;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
location ~ /\.ht {
deny all;
}
}
</code></pre></div><h3 id="enabling-configuration-2"><a href="#enabling-configuration-2" class="header-anchor">#</a> Enabling Configuration</h3> <p>The final step is to enable your NGINX configuration and restart it.</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># You do not need to symlink this file if you are using CentOS.</span>
<span class="token function">sudo</span> <span class="token function">ln</span> -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf
<span class="token comment"># You need to restart nginx regardless of OS.</span>
<span class="token function">sudo</span> systemctl restart nginx
</code></pre></div></section> <section aria-hidden="true" id="apache-with-ssl" role="tabpanel" class="tabs-component-panel" style="display:none;"><p>First, remove the default Apache configuration.</p> <div class="language-bash extra-class"><pre class="language-bash"><code>a2dissite 000-default.conf
</code></pre></div><p>Now, you should paste the contents of the file below, replacing <code>&lt;domain&gt;</code> with your domain name being used in a file called
<code>pterodactyl.conf</code> and place the file in <code>/etc/apache2/sites-available</code>, or — if on CentOS, <code>/etc/httpd/conf.d/</code>.</p> <p>Note: When using Apache, make sure you have the <code>libapache2-mod-php</code> package installed or else PHP will not display on your webserver.</p> <div class="language-conf extra-class"><div class="highlight-lines"><br><div class="highlighted"> </div><br><br><br><br><br><br><br><div class="highlighted"> </div><br><br><br><br><br><br><br><br><br><br><br><br><br><div class="highlighted"> </div><div class="highlighted"> </div><br><br></div><pre class="language-text"><code>&lt;VirtualHost *:80&gt;
ServerName &lt;domain&gt;
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
&lt;/VirtualHost&gt;
&lt;VirtualHost *:443&gt;
ServerName &lt;domain&gt;
DocumentRoot &quot;/var/www/pterodactyl/public&quot;
AllowEncodedSlashes On
php_value upload_max_filesize 100M
php_value post_max_size 100M
&lt;Directory &quot;/var/www/pterodactyl/public&quot;&gt;
Require all granted
AllowOverride all
&lt;/Directory&gt;
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/&lt;domain&gt;/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/&lt;domain&gt;/privkey.pem
&lt;/VirtualHost&gt;
</code></pre></div><h3 id="enabling-configuration-3"><a href="#enabling-configuration-3" class="header-anchor">#</a> Enabling Configuration</h3> <p>Once you've created the file above, simply run the commands below. If you are on CentOS <em>you do not need to run the commands
below!</em> You only need to run <code>systemctl restart httpd</code>.</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># You do not need to run any of these commands on CentOS</span>
<span class="token function">sudo</span> <span class="token function">ln</span> -s /etc/apache2/sites-available/pterodactyl.conf /etc/apache2/sites-enabled/pterodactyl.conf
<span class="token function">sudo</span> a2enmod rewrite
<span class="token function">sudo</span> a2enmod ssl
<span class="token function">sudo</span> systemctl restart apache2
</code></pre></div></section> <section aria-hidden="true" id="apache-without-ssl" role="tabpanel" class="tabs-component-panel" style="display:none;"><p>First, remove the default Apache configuration.</p> <div class="language-bash extra-class"><pre class="language-bash"><code>a2dissite 000-default.conf
</code></pre></div><p>Now, you should paste the contents of the file below, replacing <code>&lt;domain&gt;</code> with your domain name being used in a file called
<code>pterodactyl.conf</code> and place the file in <code>/etc/apache2/sites-available</code>, or — if on CentOS, <code>/etc/httpd/conf.d/</code>.</p> <p>Note: When using Apache, make sure you have the <code>libapache2-mod-php</code> package installed or else PHP will not display on your webserver.</p> <div class="language-conf extra-class"><div class="highlight-lines"><br><div class="highlighted"> </div><br><br><br><br><br><br><br><br><br><br><br><br><br></div><pre class="language-text"><code>&lt;VirtualHost *:80&gt;
ServerName &lt;domain&gt;
DocumentRoot &quot;/var/www/pterodactyl/public&quot;
AllowEncodedSlashes On
php_value upload_max_filesize 100M
php_value post_max_size 100M
&lt;Directory &quot;/var/www/pterodactyl/public&quot;&gt;
AllowOverride all
Require all granted
&lt;/Directory&gt;
&lt;/VirtualHost&gt;
</code></pre></div><h3 id="enabling-configuration-4"><a href="#enabling-configuration-4" class="header-anchor">#</a> Enabling Configuration</h3> <p>Once you've created the file above, simply run the commands below. If you are on CentOS <em>you do not need to run the commands
below!</em> You only need to run <code>systemctl restart httpd</code>.</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># You do not need to run any of these commands on CentOS</span>
<span class="token function">sudo</span> <span class="token function">ln</span> -s /etc/apache2/sites-available/pterodactyl.conf /etc/apache2/sites-enabled/pterodactyl.conf
<span class="token function">sudo</span> a2enmod rewrite
<span class="token function">sudo</span> systemctl restart apache2
</code></pre></div></section> <section aria-hidden="true" id="caddy-with-automatic-ssl" role="tabpanel" class="tabs-component-panel" style="display:none;"><p>Before adding our custom configuration, let's remove the default one. You can do it either by deleting the contents of config file or by deleting the config file completely and than creating a new one from scratch. The config file path is <code>/etc/caddy/Caddyfile</code>.</p> <p>To delete the config file completely, run the following command:</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">rm</span> /etc/caddy/Caddyfile
</code></pre></div><p>Then continue with an editor of your choice to write the config.</p> <p>You should paste the contents of the file below, replacing <code>&lt;domain&gt;</code> with your domain name.</p> <div class="language- extra-class"><div class="highlight-lines"><br><br><br><br><br><br><br><br><div class="highlighted"> </div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div><pre class="language-text"><code>{
servers :443 {
timeouts {
read_body 120s
}
}
}
&lt;domain&gt; {
root * /var/www/pterodactyl/public
file_server
php_fastcgi unix//run/php/php8.1-fpm.sock {
root /var/www/pterodactyl/public
index index.php
env PHP_VALUE &quot;upload_max_filesize = 100M
post_max_size = 100M&quot;
env HTTP_PROXY &quot;&quot;
env HTTPS &quot;on&quot;
read_timeout 300s
dial_timeout 300s
write_timeout 300s
}
header Strict-Transport-Security &quot;max-age=16768000; preload;&quot;
header X-Content-Type-Options &quot;nosniff&quot;
header X-XSS-Protection &quot;1; mode=block;&quot;
header X-Robots-Tag &quot;none&quot;
header Content-Security-Policy &quot;frame-ancestors 'self'&quot;
header X-Frame-Options &quot;DENY&quot;
header Referrer-Policy &quot;same-origin&quot;
request_body {
max_size 100m
}
respond /.ht* 403
log {
output file /var/log/caddy/pterodactyl.log {
roll_size 100MiB
roll_keep_for 7d
}
level INFO
}
}</code></pre></div><div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>If you are using Cloudflare DNS in proxy mode, refer to <a href="/tutorials/creating_ssl_certificates.html#method-3:-caddy-(using-cloudflare-api)">this tutorial</a>, to see how to configure Caddy to use DNS challenge for obtaining SSL certificates.</p></div> <h3 id="enabling-configuration-5"><a href="#enabling-configuration-5" class="header-anchor">#</a> Enabling Configuration</h3> <p>The final step is to restart Caddy.</p> <div class="language-bash extra-class"><pre class="language-bash"><code>systemctl restart caddy
</code></pre></div></section> <section aria-hidden="true" id="caddy-without-ssl" role="tabpanel" class="tabs-component-panel" style="display:none;"><p>Before adding our custom configuration, let's remove the default one. You can do it either by deleting the contents of config file or by deleting the config file completely and than creating a new one from scratch. The config file path is <code>/etc/caddy/Caddyfile</code>.</p> <p>To delete the config file completely, run the following command:</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">rm</span> /etc/caddy/Caddyfile
</code></pre></div><p>Then continue with an editor of your choice to write the config.</p> <p>You should paste the contents of the file below, replacing <code>&lt;domain&gt;</code> with your domain name.</p> <p>The only two differences are that we have suffixed the <code>&lt;domain&gt;</code> with <code>:80</code> and in the global config at <code>servers</code> directive, we have changed the port from <code>:443</code> to <code>:80</code>.</p> <div class="language- extra-class"><div class="highlight-lines"><br><br><br><br><br><br><br><br><div class="highlighted"> </div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div><pre class="language-text"><code>{
servers :80 {
timeouts {
read_body 120s
}
}
}
&lt;domain&gt;:80 {
root * /var/www/pterodactyl/public
file_server
php_fastcgi unix//run/php/php8.1-fpm.sock {
root /var/www/pterodactyl/public
index index.php
env PHP_VALUE &quot;upload_max_filesize = 100M
post_max_size = 100M&quot;
env HTTP_PROXY &quot;&quot;
# env HTTPS &quot;on&quot; # IMPORTANT: this is commented out, to disable HTTPS
read_timeout 300s
dial_timeout 300s
write_timeout 300s
}
header Strict-Transport-Security &quot;max-age=16768000; preload;&quot;
header X-Content-Type-Options &quot;nosniff&quot;
header X-XSS-Protection &quot;1; mode=block;&quot;
header X-Robots-Tag &quot;none&quot;
header Content-Security-Policy &quot;frame-ancestors 'self'&quot;
header X-Frame-Options &quot;DENY&quot;
header Referrer-Policy &quot;same-origin&quot;
request_body {
max_size 100m
}
respond /.ht* 403
log {
output file /var/log/caddy/pterodactyl.log {
roll_size 100MiB
roll_keep_for 7d
}
level INFO
}
}</code></pre></div><h3 id="enabling-configuration-6"><a href="#enabling-configuration-6" class="header-anchor">#</a> Enabling Configuration</h3> <p>The final step is to restart Caddy.</p> <div class="language-bash extra-class"><pre class="language-bash"><code>systemctl restart caddy
</code></pre></div></section></div></div> <h4 id="next-step-wings-installation"><a href="#next-step-wings-installation" class="header-anchor">#</a> Next Step: <a href="/wings/installing.html">Wings Installation</a></h4></div> <div class="page-edit"><div class="edit-link"><a href="https://github.com/pterodactyl/documentation/edit/master/panel/1.0/webserver_configuration.md" target="_blank" rel="noopener noreferrer">Help us improve this page.</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" 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> <span class="sr-only">(opens new window)</span></span></div> <!----></div> <!----> </div></div></div><div class="global-ui"></div></div>
<script src="/assets/js/app.f2945e27.js" defer></script><script src="/assets/js/4.166b9bf8.js" defer></script><script src="/assets/js/1.19e16341.js" defer></script><script src="/assets/js/68.ae40e5e7.js" defer></script>
</body>
</html>