1
0
mirror of https://github.com/tommytran732/Pterodactyl-Script synced 2024-11-22 18:41:32 -05:00

Fix NGINX 443

This commit is contained in:
HeyJack 2020-10-15 16:04:38 +01:00
parent de2a087a95
commit cc3f2d9888

View File

@ -1036,33 +1036,66 @@ nginx_config() {
output "Configuring Nginx Webserver..." output "Configuring Nginx Webserver..."
echo ' echo '
server_tokens off;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2c0f:f248::/32;
set_real_ip_from 2a06:98c0::/29;
real_ip_header X-Forwarded-For;
server { server {
listen 80; listen 80 default_server;
server_name '"$FQDN"'; server_name '"$FQDN"';
return 301 https://$server_name$request_uri;
root /var/www/pterodactyl/public;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
} }
server {
location = /favicon.ico { access_log off; log_not_found off; } listen 443 ssl http2 default_server;
location = /robots.txt { access_log off; log_not_found off; } server_name '"$FQDN"';
root /var/www/pterodactyl/public;
access_log off; index index.php;
access_log /var/log/nginx/pterodactyl.app-access.log;
error_log /var/log/nginx/pterodactyl.app-error.log error; error_log /var/log/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes # allow larger file uploads and longer script runtimes
client_max_body_size 100m; client_max_body_size 100m;
client_body_timeout 120s; client_body_timeout 120s;
sendfile off; sendfile off;
# SSL Configuration
ssl_certificate /etc/letsencrypt/live/'"$FQDN"'/fullchain.pem;-
ssl_certificate_key /etc/letsencrypt/live/'"$FQDN"'/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
ssl_prefer_server_ciphers on;
# See https://hstspreload.org/ before uncommenting the line below.
# add_header Strict-Transport-Security "max-age=15768000; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header Content-Security-Policy "frame-ancestors 'self'";
add_header X-Frame-Options DENY;
add_header Referrer-Policy same-origin;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ { location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
@ -1074,12 +1107,12 @@ server {
fastcgi_connect_timeout 300; fastcgi_connect_timeout 300;
fastcgi_send_timeout 300; fastcgi_send_timeout 300;
fastcgi_read_timeout 300; fastcgi_read_timeout 300;
include /etc/nginx/fastcgi_params;
} }
location ~ /\.ht { location ~ /\.ht {
deny all; deny all;
} }
}} }
' | sudo -E tee /etc/nginx/sites-available/pterodactyl.conf >/dev/null 2>&1 ' | sudo -E tee /etc/nginx/sites-available/pterodactyl.conf >/dev/null 2>&1
if [ "$lsb_dist" = "debian" ] && [ "$dist_version" = "8" ]; then if [ "$lsb_dist" = "debian" ] && [ "$dist_version" = "8" ]; then
sed -i 's/http2//g' /etc/nginx/sites-available/pterodactyl.conf sed -i 's/http2//g' /etc/nginx/sites-available/pterodactyl.conf
@ -1399,6 +1432,7 @@ webserver_config(){
setup_pterodactyl(){ setup_pterodactyl(){
install_dependencies install_dependencies
install_pterodactyl install_pterodactyl
ssl_certs
webserver_config webserver_config
} }
@ -2073,6 +2107,7 @@ case $installoption in
repositories_setup repositories_setup
required_infos required_infos
firewall firewall
ssl_certs
setup_pterodactyl setup_pterodactyl
install_wings install_wings
broadcast broadcast