IDE:TYPO3: Unterschied zwischen den Versionen

Aus ahrensburg.city
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 4: Zeile 4:


<pre>
<pre>
# TYPO3 13 LTS – NGINX vhost
# Datei: sudo nano /etc/nginx/conf.d//typo3.conf


server {
server {
     listen 80;
     listen 80;
     server_name example.com www.example.com;
     server_name localhost;
    root /var/www/typo3/public;


    # Composer-Setup: DocumentRoot zeigt auf das "public" Verzeichnis
    root /var/www/typo3/public;
     index index.php index.html;
     index index.php index.html;
    charset utf-8;


     client_max_body_size 32m;
#    include /etc/nginx/conf.d/nginx.conf;
 
    location ~ \.js\.gzip$ {
        add_header Content-Encoding gzip;
        gzip off;
        types { text/javascript gzip; }
    }
     location ~ \.css\.gzip$ {
        add_header Content-Encoding gzip;
        gzip off;
        types { text/css gzip; }
    }
 
    # TYPO3 - Rule for versioned static files, configured through:
    # - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
    # - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
    if (!-e $request_filename) {
        rewrite ^/(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ /$1.$3 last;
    }
 
    # TYPO3 - Block access to composer files
    location ~* composer\.(?:json|lock) {
        deny all;
    }


     # Basis-Security-Header
     # TYPO3 - Block access to flexform files
     add_header X-Content-Type-Options nosniff;
     location ~* flexform[^.]*\.xml {
    add_header X-Frame-Options SAMEORIGIN;
        deny all;
     add_header Referrer-Policy no-referrer-when-downgrade;
     }
    add_header X-XSS-Protection "1; mode=block";


     # Front-Controller
     # TYPO3 - Block access to language files
     location / {
     location ~* locallang[^.]*\.(?:xml|xlf)$ {
         try_files $uri $uri/ /index.php$is_args$args;
         deny all;
    }
 
    # TYPO3 - Block access to static typoscript files
    location ~* ext_conf_template\.txt|ext_typoscript_constants\.txt|ext_typoscript_setup\.txt {
        deny all;
     }
     }


     # TYPO3 Backend: leitet über Front-Controller
     # TYPO3 - Block access to miscellaneous protected files
     location ^~ /typo3/ {
     location ~* /.*\.(?:bak|co?nf|cfg|ya?ml|ts|typoscript|tsconfig|dist|fla|in[ci]|log|sh|sql|sqlite)$ {
         try_files $uri /index.php$is_args$args;
         deny all;
     }
     }


     # Statische Assets
     # TYPO3 - Block access to recycler and temporary directories
     location ~* \.(?:css|js|gif|ico|jpg|jpeg|png|svg|webp|avif|woff|woff2|ttf|eot)$ {
     location ~ _(?:recycler|temp)_/ {
         try_files $uri =404;
         deny all;
        access_log off;
        expires 7d;
        add_header Cache-Control "public, immutable";
     }
     }


     # Favicons / Robots
     # TYPO3 - Block access to configuration files stored in fileadmin
     location = /favicon.ico { log_not_found off; access_log off; }
     location ~ fileadmin/(?:templates)/.*\.(?:txt|ts|typoscript)$ {
     location = /robots.txt  { log_not_found off; access_log off; }
        deny all;
     }


     # Versteckte/empfindliche Dateien sperren
     # TYPO3 - Block access to libraries, source and temporary compiled data
    location ~ /\.(?!well-known) { deny all; }
     location ~ ^(?:vendor|typo3_src|typo3temp/var) {
    location ~* /(composer\.(json|lock)|package\.json|yarn\.lock|webpack\..*|tsconfig\.json)$ { deny all; }
        deny all;
    location ~* (?:^|/)(?:LocalConfiguration|AdditionalConfiguration)\.php$ { deny all; }
    }
     location ~* ^/(?:typo3conf|var|vendor|Build|Tests)(?:/|$) { deny all; }


     # Keine PHP-Ausführung in Upload-/Asset-Ordnern
     # TYPO3 - Block access to protected extension directories
     location ~* ^/(?:fileadmin|uploads|typo3temp|typo3conf|storage)/.*\.php$ {
     location ~ (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ {
         deny all;
         deny all;
     }
     }


    # PHP-FPM
     location / {
     location ~ \.php$ {
         try_files $uri $uri/ /index.php$is_args$args;
         try_files $uri =404;
    }
         include fastcgi_params;
 
         fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    location = /typo3 {
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        rewrite ^ /typo3/;
         fastcgi_param TYPO3_CONTEXT Production;
    }
         fastcgi_param HTTPS $https if_not_empty;
 
         fastcgi_buffers 16 16k;
    location /typo3/ {
         absolute_redirect off;
         try_files $uri /typo3/index.php$is_args$args;
    }
 
    location ~ [^/]\.php(/|$) {
         fastcgi_split_path_info ^(.+?\.php)(/.*)$;
         if (!-f $document_root$fastcgi_script_name) {
            return 404;
         }
         fastcgi_buffer_size 32k;
         fastcgi_buffer_size 32k;
         fastcgi_read_timeout 120s;
        fastcgi_buffers 8 16k;
         # Pfad ggf. auf die installierte PHP-Version anpassen (8.2/8.3)
        fastcgi_connect_timeout 240s;
         fastcgi_pass unix:/run/php/php8.2-fpm.sock;
         fastcgi_read_timeout 240s;
        fastcgi_index index.php;
         fastcgi_send_timeout 240s;
 
        include              snippets/fastcgi-php.conf;
         fastcgi_pass         unix:/var/run/php/php8.4-fpm.sock;
     }
     }
}
}
<pre>
sudo chown -R www-data:www-data /var/www/typo3
sudo chmod -R 775 /var/www/typo3
</pre>
</pre>
sudo chown www-data:www-data /var/www/typo3/public/typo3/install.php
sudo chmod 644 /var/www/typo3/public/typo3/install.php

Aktuelle Version vom 29. Oktober 2025, 03:06 Uhr

composer create-project "typo3/cms-base-distribution:^13.4" /var/www/typo3

server {
    listen 80;
    server_name localhost;
    root /var/www/typo3/public;

    index index.php index.html;

#    include /etc/nginx/conf.d/nginx.conf;

    location ~ \.js\.gzip$ {
        add_header Content-Encoding gzip;
        gzip off;
        types { text/javascript gzip; }
    }
    location ~ \.css\.gzip$ {
        add_header Content-Encoding gzip;
        gzip off;
        types { text/css gzip; }
    }

    # TYPO3 - Rule for versioned static files, configured through:
    # - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
    # - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
    if (!-e $request_filename) {
        rewrite ^/(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ /$1.$3 last;
    }

    # TYPO3 - Block access to composer files
    location ~* composer\.(?:json|lock) {
        deny all;
    }

    # TYPO3 - Block access to flexform files
    location ~* flexform[^.]*\.xml {
        deny all;
    }

    # TYPO3 - Block access to language files
    location ~* locallang[^.]*\.(?:xml|xlf)$ {
        deny all;
    }

    # TYPO3 - Block access to static typoscript files
    location ~* ext_conf_template\.txt|ext_typoscript_constants\.txt|ext_typoscript_setup\.txt {
        deny all;
    }

    # TYPO3 - Block access to miscellaneous protected files
    location ~* /.*\.(?:bak|co?nf|cfg|ya?ml|ts|typoscript|tsconfig|dist|fla|in[ci]|log|sh|sql|sqlite)$ {
        deny all;
    }

    # TYPO3 - Block access to recycler and temporary directories
    location ~ _(?:recycler|temp)_/ {
        deny all;
    }

    # TYPO3 - Block access to configuration files stored in fileadmin
    location ~ fileadmin/(?:templates)/.*\.(?:txt|ts|typoscript)$ {
        deny all;
    }

    # TYPO3 - Block access to libraries, source and temporary compiled data
    location ~ ^(?:vendor|typo3_src|typo3temp/var) {
        deny all;
    }

    # TYPO3 - Block access to protected extension directories
    location ~ (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ {
        deny all;
    }

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location = /typo3 {
        rewrite ^ /typo3/;
    }

    location /typo3/ {
        absolute_redirect off;
        try_files $uri /typo3/index.php$is_args$args;
    }

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
        fastcgi_buffer_size 32k;
        fastcgi_buffers 8 16k;
        fastcgi_connect_timeout 240s;
        fastcgi_read_timeout 240s;
        fastcgi_send_timeout 240s;

        include              snippets/fastcgi-php.conf;
        fastcgi_pass         unix:/var/run/php/php8.4-fpm.sock;
    }
}

<pre>

sudo chown -R www-data:www-data /var/www/typo3
sudo chmod -R 775 /var/www/typo3

sudo chown www-data:www-data /var/www/typo3/public/typo3/install.php sudo chmod 644 /var/www/typo3/public/typo3/install.php