67 lines
1.8 KiB
Bash
67 lines
1.8 KiB
Bash
#!/bin/bash
|
|
|
|
# Domæne du vil bruge til Pterodactyl Panel (SKAL REDIGERES!)
|
|
DOMAIN="panel.ditdomæne.dk"
|
|
|
|
# Opret hovedmapper
|
|
mkdir -p /srv/pterodactyl/{panel,wings,mysql/data,servers}
|
|
mkdir -p /srv/pterodactyl/nginx/{conf.d,certbot/{conf,www}}
|
|
|
|
# Opret Nginx konfigurationsfil
|
|
cat <<EOF > /srv/pterodactyl/nginx/conf.d/default.conf
|
|
server {
|
|
listen 80;
|
|
server_name ${DOMAIN};
|
|
|
|
location ~ /.well-known/acme-challenge {
|
|
allow all;
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name ${DOMAIN};
|
|
|
|
# SSL konfiguration (Certbot stier)
|
|
ssl_certificate /etc/letsencrypt/live/${DOMAIN}/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/${DOMAIN}/privkey.pem;
|
|
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
root /var/www/html/public;
|
|
index index.html index.php;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
fastcgi_pass panel:9000;
|
|
fastcgi_index index.php;
|
|
include fastcgi_params;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
}
|
|
|
|
location ~ /\. {
|
|
deny all;
|
|
}
|
|
}
|
|
EOF
|
|
|
|
echo "✅ Mappestruktur og Nginx konfiguration er oprettet."
|
|
|
|
# Generer dummy certifikater for at starte Nginx
|
|
openssl req -x509 -nodes -newkey rsa:4096 -days 365 -keyout /srv/pterodactyl/nginx/certbot/conf/privkey.pem -out /srv/pterodactyl/nginx/certbot/conf/fullchain.pem -subj "/CN=${DOMAIN}" 2>/dev/null
|
|
|
|
echo "✅ Dummy SSL-certifikater oprettet."
|
|
echo ""
|
|
echo "Næste trin: Rediger 'docker-compose.yml' og kør 'docker-compose up -d'."
|