1+ # If using Ubuntu this file should be placed in:
2+ # /etc/nginx/sites-available/
3+ #
4+ server {
5+ listen 80;
6+ server_name <domain>;
7+ return 301 https://$server_name$request_uri;
8+ }
9+
10+ server {
11+ listen 443 ssl http2;
12+ server_name <domain>;
13+
14+ root /var/www/pterodactyl/public;
15+ index index.php;
16+
17+ access_log /var/log/nginx/pterodactyl.app-access.log;
18+ error_log /var/log/nginx/pterodactyl.app-error.log error;
19+
20+ # allow larger file uploads and longer script runtimes
21+ client_max_body_size 100m;
22+ client_body_timeout 120s;
23+
24+ sendfile off;
25+
26+ # strengthen ssl security
27+ ssl_certificate /etc/letsencrypt/live/<domain>/fullchain.pem;
28+ ssl_certificate_key /etc/letsencrypt/live/<domain>/privkey.pem;
29+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
30+ ssl_prefer_server_ciphers on;
31+ ssl_session_cache shared:SSL:10m;
32+ ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
33+
34+ # See the link below for more SSL information:
35+ # https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
36+ #
37+ # ssl_dhparam /etc/ssl/certs/dhparam.pem;
38+
39+ # Add headers to serve security related headers
40+ add_header Strict-Transport-Security "max-age=15768000; preload;";
41+ add_header X-Content-Type-Options nosniff;
42+ add_header X-XSS-Protection "1; mode=block";
43+ add_header X-Robots-Tag none;
44+ add_header Content-Security-Policy "frame-ancestors 'self'";
45+
46+ location / {
47+ try_files $uri $uri/ /index.php?$query_string;
48+ }
49+
50+ location ~ \.php$ {
51+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
52+ fastcgi_pass unix:/run/php/pterodactyl.sock;
53+ fastcgi_index index.php;
54+ include fastcgi_params;
55+ fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
56+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
57+ fastcgi_param HTTP_PROXY "";
58+ fastcgi_intercept_errors off;
59+ fastcgi_buffer_size 16k;
60+ fastcgi_buffers 4 16k;
61+ fastcgi_connect_timeout 300;
62+ fastcgi_send_timeout 300;
63+ fastcgi_read_timeout 300;
64+ include /etc/nginx/fastcgi_params;
65+ }
66+
67+ location ~ /\.ht {
68+ deny all;
69+ }
70+ }
0 commit comments