CMS/Typo3/Voraussetzungen

Voraussetzungen für die Installation von Typo3 auf Ubuntu

1. PHP und benötigte Erweiterungen installieren

Führen Sie folgenden Befehl aus, um PHP und alle benötigten Erweiterungen zu installieren:

sudo apt install php-fpm php-pgsql php-xml php-curl php-gd php-mbstring php-xmlrpc php-zip php-intl php-json php-cli php-common php-apcu php-bcmath php-soap php-ldap php-imagick php-zip php-gmp -y

1.1. PostgreSQL PHP-Treiber installieren

Um Typo3 mit einer PostgreSQL-Datenbank zu verwenden, muss der passende PHP-Treiber installiert sein. Installieren Sie den Treiber mit folgendem Befehl:

sudo -u postgres -i
createdb -E UTF8 -O thorsten typo3
exit # Ausloggen
sudo apt-get install php-pgsql

1.2. SQLite3 PHP-Treiber installieren

Um Drupal mit einer SQLite3-Datenbank zu verwenden, muss der passende PHP-Treiber installiert sein. Installieren Sie den Treiber mit folgendem Befehl:

sudo apt-get update
sudo apt-get install php-sqlite3

2. Composer installieren

Composer ist ein Paketmanager für PHP. Installieren Sie Composer mit diesen Befehlen:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer

3. Nginx Webserver installieren

Installieren Sie Nginx mit folgendem Befehl:

sudo apt-get install nginx

Entfernen Sie die Standardkonfiguration:

sudo rm /etc/nginx/sites-enabled/default

4. Nginx Konfigration

Erstellen Sie eine neue Nginx-Konfigurationsdatei für Ihre Typo3-Installation:

sudo nano /etc/nginx/conf.d/typo3.conf

Fügen Sie die folgende Konfiguration ein:

server {
    listen 80;
    server_name typo3.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;
    }
}

Kategorien: Keine
Zuletzt aktualisiert am 13.01.2026 04:52