server { listen 80; listen [::]:80; server_name shop.example.com www.shop.example.com; root /var/www/pc-shop/public; location ^~ /.well-known/acme-challenge/ { default_type "text/plain"; try_files $uri =404; } location / { return 301 https://$host$request_uri; } } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name shop.example.com www.shop.example.com; root /var/www/pc-shop/public; index index.php; ssl_certificate /etc/letsencrypt/live/shop.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/shop.example.com/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; charset utf-8; client_max_body_size 20m; add_header X-Frame-Options "SAMEORIGIN"; add_header X-Content-Type-Options "nosniff"; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; 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; } error_page 404 /index.php; location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_pass unix:/run/php/php8.2-fpm.sock; fastcgi_read_timeout 60s; } location ~ /\.(?!well-known).* { deny all; } }