Habe auch eine Nginx Config welche mit Contao 4.9.16 problemlos funktioniert (PHP7.4 und PHP8.0: fastcgi_pass unix: )
nginx.conf
Code:
gzip on;
gzip_types application/atom+xml application/geo+json application/javascript application/x-javascript application/json application/ld+json application/manifest+json applidf+xml application/rss+xml application/xhtml+xml application/xml font/eot font/otf font/ttf image/svg+xml text/css text/javascript text/plain text/xml;
vhost.conf
Code:
server {
listen 80;
server_name www.meineseite.at meineseite.at;
index index.php app.php index.html index.htm;
return 301 https://www.meineseite.at$request_uri;
}
server {
listen 443 ssl http2;
index index.php app.php index.html index.htm;
server_name meineseite.at;
ssl_certificate /etc/letsencrypt/live/meineseite.at/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/meineseite.at/privkey.pem;
include snippets/ssl.conf;
return 301 https://www.meineseite.at\$request_uri;
}
server {
listen 443 ssl http2;
server_name www.meineseite.at;
index index.php app.php index.html index.htm;
root /var/www/vhosts/meineseite/htdocs/web;
location / {
index index.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
location ~ ^/(preview|index|info|app|app_dev|config|install|contao-manager\.phar)\.php(/|$) { #Secure Contao
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param open_basedir "/var/www/vhosts/meineseite/htdocs/:/var/www/vhosts/meineseite/tmp/:/var/www/vhosts/meineseite/files/:/tmp:/usr/share/pear:/var/lib/php/sessions/:/var/www/vhosts/meineseite/sessions/:/var/www/vhosts/100002/phpcache";
fastcgi_pass unix:/var/run/php/php7.4-meineseite.sock;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
fastcgi_buffers 16 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
open_file_cache max=2000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
location ~ \.(jpg|jpeg|png|gif|ico|webp|css|js|svg|woff2?|ttf|otf|eot)$ {
expires 1M;
try_files $uri $uri/ /index.php$is_args$args;
}
ssl_certificate /etc/letsencrypt/live/meineseite.at/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/meineseite.at/privkey.pem;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
ssl_ecdh_curve secp384r1;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
resolver 1.1.1.1 8.8.8.8 valid=300s;
resolver_timeout 5s;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
access_log /var/www/vhosts/meineseite/logs/access.log;
error_log /var/www/vhosts/meineseite/logs/error.log error;
}