Hier findet ihr ein kleines Hilfeskript. Dieses muss unbedingt als root ausgeführt werden! Vorausgesetzt wird ein Linux mit installiertem apt-get. Mit diesem Skript wird zuerst das Betriebssystem aktualisiert und im Anschluss werden folgende Dinge installiert:
- MariaDB Server und Client
- nginx Webserver
- PHP 7.0-FPM
- PHP 7.0 MySQL Binds, welche die MySQL/MariaDB Funktionen zur Verbindung liefern
- phpMyAdmin
- openssh-server für den SCP Zugriff im Anschluss
Nach den Paketinstallationen muss man lediglich phpmyadmin konfigurieren. Hier ist es im Grunde nur wichtig, dass man den Benutzer und das Passwort angibt, sodass sich phpmyadmin mit der MySQL bzw. in diesem Fall MariaDB verbinden kann. Wer statt MariaDB lieber MySQL verwenden möchte muss lediglich die Pakete mariadb-server und mariadb-client ändern in mysql-server und mysql-client. Der Rest ist identisch.
Im Anschluss daran werden die php.ini und die www.conf automatisch angepasst und zum Schluss wird nginx für PHP und phpmyadmin konfiguriert. So ist es möglich, dass PHP-Skripte ausgeführt werden können und phpMyAdmin über die URL http://eure-ip-oder-hostname/phpmyadmin erreichbar wird.
Dieses Skript wurde am 10.01.2017 erstellt und am selben Tag mit einem Clean-Install von Ubuntu Server 16.10 getestet.
Installations-Skript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
#!/bin/bash # Update System OS apt-get -y update apt-get -y upgrade apt-get -y dist-upgrade # Install openssh-server for SCP access apt-get -y install openssh-server # Install MariaDB apt-get -y install mariadb-server mariadb-client # Install nginx apt-get -y install nginx # Install PHP 7.0 FPM apt-get -y install php7.0-fpm # Install Packages apt-get -y install php7.0-mysql # Configure MySQL Secure Installation mysql_secure_installation # Install phpmyadmin apt-get -y install phpmyadmin # Configure phpmyadmin dpkg-reconfigure -plow phpmyadmin # Set cgi.fix_pathinfo to 0 in /etc/php/7.0/fpm/php.ini sed -i "s/cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/7.0/fpm/php.ini # Change .sock to listen ip:port sed -i "s/listen = /var/run/php7.0-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php/7.0/fpm/pool.d/www.conf # Configure /etc/nginx/sites-available/default for php/phpmyadmin cat << EOF > /etc/nginx/sites-available/default ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # http://wiki.nginx.org/Pitfalls # http://wiki.nginx.org/QuickStart # http://wiki.nginx.org/Configuration # # Generally, you will want to move this file somewhere, and start with a clean # file but keep this around for reference. Or just disable in sites-enabled. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # Default server configuration # server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files \$uri \$uri/ =404; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { include snippets/fastcgi-php.conf; # # # With php7.0-cgi alone: fastcgi_pass 127.0.0.1:9000; # # With php7.0-fpm: # fastcgi_pass unix:/run/php/php7.0-fpm.sock; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files \$uri =404; root /usr/share/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; include /etc/nginx/fastcgi_params; } } location /phpMyAdmin { rewrite ^/* /phpmyadmin last; } } # Virtual Host configuration for example.com # # You can move that to a different file under sites-available/ and symlink that # to sites-enabled/ to enable it. # #server { # listen 80; # listen [::]:80; # # server_name example.com; # # root /var/www/example.com; # index index.html; # # location / { # try_files $uri $uri/ =404; # } #} EOF |