• Tja, was soll ich sagen? Es war nicht ganz so einfach alle Informationen zusammen zu bekommen um Nginx vernünftig für Joomla! zu konfigurieren.

    ### Joomla!
    
    ### redirect http requests to non-www https
    server {
        listen 80;
        listen [::]:80;
        server_name frank-mankel.de www.frank-mankel.de;
        return 301 https://frank-mankel.de$request_uri;
    }
    
    
    ### https Joomla!
    
    ### redirect www requests to non-www
    server {
        listen 443 ssl http2;
        ssl_certificate      /etc/letsencrypt/live/frank-mankel.de/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/frank-mankel.de/privkey.pem;
        server_name www.frank-mankel.de;
        return 301 https://frank-mankel.de$request_uri;
    }
    
    server {
        location /administrator {
        auth_basic            "Restricted Area";
        auth_basic_user_file  /etc/nginx/.htpasswd;
    }
    
    ## Begin - Server Info
    
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    index index.html index.php;
    root /var/www/joomla;
    server_name frank-mankel.de www.frank-mankel.de;
    
    ## End - Server Info
    
    ## Start SSL
    
    ssl_certificate      /etc/letsencrypt/live/frank-mankel.de/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/frank-mankel.de/privkey.pem;
    
    # enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
    ssl_protocols TLSv1.2;
    
    # disables all weak ciphers
    ssl_ciphers ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES256:ECDH+AES128:!aNULL:!SHA1;
    ssl_prefer_server_ciphers on;
    
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; always";
    
    ssl_stapling on;
    #ssl_trusted_certificate /pfad/bundle.ca.pem;
    ssl_stapling_verify on;
    
    ssl_dhparam /etc/nginx/dhparams.pem;
    
    ## End SSL
    
    ## Begin - Index
    # for subfolders, simply adjust:
    # `location /subfolder {`
    # and the rewrite to use `/subfolder/index.php`
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    ## End - Index
    
    ## Begin - Security
    # deny running scripts inside writable directories
    location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
            return 403;
            error_page 403 /403_error.html;
    }
    ## End - Security
    
    ## Start - Caching
    # caching of files
    location ~* \.(ico|pdf|flv)$ {
            expires 1y;
    }
    
    location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                expires 14d;
        }
    ## End - Caching
    
    ## Begin - PHP
    location ~ \.php$ {
        # Choose either a socket or TCP/IP address
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        # fastcgi_pass unix:/var/run/php5-fpm.sock; #legacy
        # fastcgi_pass 127.0.0.1:9000;
    
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    }
        ## End - PHP
    }
    

    Zwei Dinge.

    SSL

    Das SSL Zertifikat ist von Letsencrypt, es erreicht beim Test auf ssllabs,com A+

    0_1539020880959_4ddd2aa7-0aff-4032-8d34-d0a3da87b19d-grafik.png

    Joomla! Beispiel Konfig

    Ich finde es sehr schade, das man darin nicht direkt angibt wie man das Administrator Verzeichnis mit einem Passwort schützt. Es wird immer wieder erwähnt wie wichtig das ist und dann fehlt so was. Schade.

    Fazit

    Läuft 🙂 Wieder extrem viel gelernt. Sollte ein Nginx-Experte was sehen, was schlecht ist, ich freue mich immer über Verbesserungen! Viel Spaß beim Testen, wie immer auf eigenes Risiko!

    Quellen

  • 1
  • 1
  • 2
  • 2
  • 1
  • 1
  • 1