Skip to content

Installation von Grav & NGinx & PHP7.2

Angeheftet Verschoben Grav
  • Wird nochmal überarbeitet, da ich noch über einige Probleme gestolpert bin! Für Einsteiger im Moment nur bedingt zu empfehlen!

    Ich hatte schon mal auf einem Debian System PHP7 installiert -> https://frank-mankel.de/kategorien/15-joomla/202-debian-joomla-mit-php7-auf-nginx

    Nun habe ich das auf einem ROCKPro64 gemacht und ein wenig Kopfschmerzen bekommen 😉 Ziel des Ganzen ist es eine Grav-Installation zum Laufen zu bekommen.

    Hardware

    • ROCKPro64 v2.0

    Software

    Linux

    rock64@rockpro64v2_0:~$ uname -a
    Linux rockpro64v2_0 4.4.132-1081-rockchip-ayufan-g50be7e64a779 #1 SMP Tue Jul 31 20:09:25 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
    

    NGinx

    rock64@rockpro64:~$ nginx -v
    nginx version: nginx/1.14.0 (Ubuntu)
    

    PHP

     rock64@rockpro64:~$ php -v
     PHP 7.2.7-0ubuntu0.18.04.2 (cli) (built: Jul  4 2018 16:55:24) ( NTS )
     Copyright (c) 1997-2018 The PHP Group
     Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
         with Zend OPcache v7.2.7-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
    

    Installation

    NGinx

    sudo apt-get install nginx 
    

    PHP

    sudo apt-get install php7.2
    

    Benötigte Module für PHP

    sudo apt-get install php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml php7.2-xsl php7.2-zip
    sudo apt-get install php7.2-cli php7.2-curl php7.2-gd php7.2-geoip php7.2-intl php7.2-json php7.2-mbstring
    

    Konfiguration NGinx

    /etc/nginx/nginx.conf

    user www-data;
    worker_processes auto;
    worker_rlimit_nofile 8192; # should be bigger than worker_connections
    pid /run/nginx.pid;
    
    events {
        use epoll;
        worker_connections 8000;
        multi_accept on;
    }
    
    http {
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
    
        keepalive_timeout 30; # longer values are better for each ssl client, but take up a worker connection longer
        types_hash_max_size 2048;
        server_tokens off;
    
        # maximum file upload size
        # update 'upload_max_filesize' & 'post_max_size' in /etc/php5/fpm/php.ini accordingly
        client_max_body_size 32m;
        # client_body_timeout 60s; # increase for very long file uploads
    
        # set default index file (can be overwritten for each site individually)
        index index.html;
    
        # load MIME types
        include mime.types; # get this file from https://github.com/h5bp/server-configs-nginx
        default_type application/octet-stream; # set default MIME type
    
        # logging
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
    
        # turn on gzip compression
        gzip on;
        gzip_disable "msie6";
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 5;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_min_length 256;
        gzip_types
            application/atom+xml
            application/javascript
            application/json
            application/ld+json
            application/manifest+json
            application/rss+xml
            application/vnd.geo+json
            application/vnd.ms-fontobject
            application/x-font-ttf
            application/x-web-app-manifest+json
            application/xhtml+xml
            application/xml
            font/opentype
            image/bmp
            image/svg+xml
            image/x-icon
            text/cache-manifest
            text/css
            text/plain
            text/vcard
            text/vnd.rim.location.xloc
            text/vtt
            text/x-component
            text/x-cross-domain-policy;
        
        # disable content type sniffing for more security
        add_header "X-Content-Type-Options" "nosniff";
        
        # force the latest IE version
        add_header "X-UA-Compatible" "IE=Edge";
        
        # enable anti-cross-site scripting filter built into IE 8+
        add_header "X-XSS-Protection" "1; mode=block";
        
        # include virtual host configs
        include sites-enabled/*;
    }
    

    Unter /etc/nginx/sites-available die Datei default löschen. Die Datei grav-site anlegen.

    /etc/nginx/sites-available/grav-site

    server {
        #listen 80;
        index index.html index.php;
    
        ## Begin - Server Info
        root /var/www/grav;
        server_name localhost;
        ## End - Server Info
    
        ## 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 all direct access for these folders
        location ~* /(\.git|cache|bin|logs|backup|tests)/.*$ { return 403; }
        # deny running scripts inside core system folders
        location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
        # deny running scripts inside user folder
        location ~* /user/.*\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
        # deny access to specific files in the root folder
        location ~ /(LICENSE\.txt|composer\.lock|composer\.json|nginx\.conf|web\.config|htaccess\.txt|\.htaccess) { return 403; }
        ## End - Security
    
        ## Begin - PHP
        location ~ \.php$ {
            # Choose either a socket or TCP/IP address
            #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
             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
    }
    

    Danach brauchen wir einen symbolischen Link in /etc/nginx/sites-enabled Nur dann funktioniert eine Seite.

    sudo ln -s /etc/nginx/sites-available/grav-site /etc/nginx/sites-enabled/
    

    Installation Grav

    Core installieren
    Option 3 der Anleitung https://learn.getgrav.org/basics/installation

    Admin Panel installieren
    https://learn.getgrav.org/admin-panel/introduction

    Meine Grav-Installation liegt unter

     /var/www/grav
    

    Womit hatte ich nun Probleme? NGinx dient ja als Webserver, dieser Webserver muss jetzt die PHP-Dateien entsprechend verarbeiten können. Dazu gibt es folgenden Block in der Datei /etc/nginx/sites-available/grav-site

     ## Begin - PHP
         location ~ \.php$ {
             # Choose either a socket or TCP/IP address
             #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
              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
    

    Es war vorher folgendermaßen

    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    #fastcgi_pass 127.0.0.1:9000;
    

    Das hat nicht geklappt. Was sagt die Ubuntu Seite dazu?? Man soll folgendes machen. Datei /usr/local/bin/php-fastcgi anlegen.

     #!/bin/bash
     php-cgi -b 127.0.0.1:9000
    

    Ausführungsrechte

    chmod a+x /usr/local/bin/php-fastcgi 
    

    Danach starten

     sudo php-fastcgi 
    

    Das funktioniert aber nur, wenn folgendes eingestellt ist.

    #fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_pass 127.0.0.1:9000;
    

    Damit wird PHP direkt an die FastCGI-Schnittstelle gebunden.

    Quelle: https://wiki.ubuntuusers.de/nginx/PHP/

    Danach lief meine Grav-Installation.

    0_1532448808009_Grav_ergebnis.jpg

    So weit so gut. Ein kleiner Schönheitsfehler. Konsole zu beendet

    sudo php-fastcgi 
    

    dann war es das wieder mit NGinx. Die Lösung wir brauchen eine Datei /etc/rc.local

    #!/bin/bash
    #
    # rc.local - executed at the end of each multiuser runlevel
    #
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    php-fastcgi 
    exit 0
    

    Den Dienst dann nach dieser Anleitung einrichten

    Danach den Server neu starten und es funktioniert!

    Achtung! Nicht auf einem produktiven System einsetzen, ich bin mir nicht sicher ob das zu 100% sicher ist.

  • Nachdem ich den ROCKPro64 jetzt auf den Mainline umgestellt habe, lief meine Testinstallation von Grav nicht mehr.

    Hilfreiche Sache um das Problem zu lösen -> https://gist.github.com/GhazanfarMir/03bd1f1f770a3834d47274586d46ea62

    Ich bekam immer 502 Bad Gateway, Grund war ein nicht korrekt gestarteter php-pfm Service.

    rock64@rockpro64v2_0:/usr/local/bin$ sudo service php7.2-fpm start
    rock64@rockpro64v2_0:/usr/local/bin$ sudo service php7.2-fpm status
    ● php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager
       Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled)
       Active: active (running) since Thu 2018-08-16 20:15:20 CEST; 21s ago
         Docs: man:php-fpm7.2(8)
     Main PID: 3206 (php-fpm7.2)
       Status: "Processes active: 0, idle: 2, Requests: 3, slow: 0, Traffic: 0.2req/sec"
        Tasks: 3 (limit: 4622)
       CGroup: /system.slice/php7.2-fpm.service
               ├─3206 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)
               ├─3207 php-fpm: pool www
               └─3208 php-fpm: pool www
    
    Aug 16 20:15:19 rockpro64v2_0 systemd[1]: Starting The PHP 7.2 FastCGI Process Manager...
    Aug 16 20:15:20 rockpro64v2_0 systemd[1]: Started The PHP 7.2 FastCGI Process Manager.
    

  • LUKS Key Derivation Function

    Linux
    1
    0 Stimmen
    1 Beiträge
    52 Aufrufe
    Niemand hat geantwortet
  • Debian Bookworm 12 - Firefox

    Linux
    1
    0 Stimmen
    1 Beiträge
    228 Aufrufe
    Niemand hat geantwortet
  • LMDE Beta

    Linux
    1
    0 Stimmen
    1 Beiträge
    121 Aufrufe
    Niemand hat geantwortet
  • 1 Stimmen
    85 Beiträge
    5k Aufrufe
    N

    Immer wieder gerne. Dieses mal gab es richtig etwas zu tun:
    13 files changed, 137 insertions(+), 96 deletions(-)
    Und das nur, damit es überhaupt wieder baut. Danach folgten noch 5 Bugfixing Runden, wobei zwei davon (lediglich) das Packaging betrafen.

    Ergänzend noch ein Hinweis:
    Port 3012 für die Websocket Verbindungen ist jetzt offiziell deprecated und wird demnächst vollständig aus Vaultwarden entfernt. Genau jetzt wäre der richtige Zeitpunkt die Apache/Nginx Konfiguration dahingehend anzupassen.

    Hierfür habe ich neue Templates online gestellt.
    Apache: https://bitwarden-deb.tech-network.de/Apache-VirtualHost.example.conf
    Nginx: https://bitwarden-deb.tech-network.de/Nginx-VirtualHost.example.conf

    Schönen Sonntag!

  • Ubiquiti ER-X - iperf

    Verschoben OpenWRT & Ubiquiti ER-X
    2
    0 Stimmen
    2 Beiträge
    252 Aufrufe
    FrankMF

    Hier noch ein Test von DMZ / LAN und andersrum.

    frank@frank-MS-7C37:~$ iperf3 -c 192.168.5.15 Connecting to host 192.168.5.15, port 5201 [ 5] local 192.168.3.213 port 44052 connected to 192.168.5.15 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 114 MBytes 952 Mbits/sec 314 153 KBytes [ 5] 1.00-2.00 sec 112 MBytes 937 Mbits/sec 259 205 KBytes [ 5] 2.00-3.00 sec 111 MBytes 929 Mbits/sec 210 212 KBytes [ 5] 3.00-4.00 sec 111 MBytes 934 Mbits/sec 235 202 KBytes [ 5] 4.00-5.00 sec 112 MBytes 936 Mbits/sec 263 153 KBytes [ 5] 5.00-6.00 sec 111 MBytes 935 Mbits/sec 255 209 KBytes [ 5] 6.00-7.00 sec 112 MBytes 937 Mbits/sec 313 129 KBytes [ 5] 7.00-8.00 sec 111 MBytes 932 Mbits/sec 296 209 KBytes [ 5] 8.00-9.00 sec 111 MBytes 934 Mbits/sec 258 208 KBytes [ 5] 9.00-10.00 sec 111 MBytes 934 Mbits/sec 292 201 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 1.09 GBytes 936 Mbits/sec 2695 sender [ 5] 0.00-10.00 sec 1.09 GBytes 935 Mbits/sec receiver iperf Done. frank@frank-MS-7C37:~$ iperf3 -R -c 192.168.5.15 Connecting to host 192.168.5.15, port 5201 Reverse mode, remote host 192.168.5.15 is sending [ 5] local 192.168.3.213 port 44058 connected to 192.168.5.15 port 5201 [ ID] Interval Transfer Bitrate [ 5] 0.00-1.00 sec 109 MBytes 911 Mbits/sec [ 5] 1.00-2.00 sec 109 MBytes 912 Mbits/sec [ 5] 2.00-3.00 sec 109 MBytes 912 Mbits/sec [ 5] 3.00-4.00 sec 109 MBytes 912 Mbits/sec [ 5] 4.00-5.00 sec 109 MBytes 912 Mbits/sec [ 5] 5.00-6.00 sec 108 MBytes 903 Mbits/sec [ 5] 6.00-7.00 sec 109 MBytes 912 Mbits/sec [ 5] 7.00-8.00 sec 109 MBytes 912 Mbits/sec [ 5] 8.00-9.00 sec 109 MBytes 912 Mbits/sec [ 5] 9.00-10.00 sec 109 MBytes 912 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 1.06 GBytes 913 Mbits/sec 114 sender [ 5] 0.00-10.00 sec 1.06 GBytes 911 Mbits/sec receiver iperf Done.
  • Nextcloud Talk

    Nextcloud
    5
    0 Stimmen
    5 Beiträge
    767 Aufrufe
    FrankMF

    All I needed to do was setting the permissions to 744 for the archive directory and the symlinks resolved correctly after a reboot of coturn

    My turnserver installation on Debian runs as the user turnserver and not as root, nor is the user turnserver in any group owning the letsencrypt directory.
    If your turnserver does run as root, it should be fine just adding execute permissions.

    I hope this helps some of you.
    Quelle: https://help.nextcloud.com/t/lets-encrypt-symlink-breaks-coturn-configuration/70166

    Was zum Testen die Tage....

  • Veracrypt Volume einhängen

    Linux
    1
    0 Stimmen
    1 Beiträge
    802 Aufrufe
    Niemand hat geantwortet
  • Youtube in Grav

    Grav
    1
    0 Stimmen
    1 Beiträge
    503 Aufrufe
    Niemand hat geantwortet