User Tools

Site Tools


servers:nginx:phpmyadmin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
servers:nginx:phpmyadmin [2016/06/26 11:50]
Sean Rhone [Timer]
servers:nginx:phpmyadmin [2016/06/26 11:50] (current)
Sean Rhone [PHP-FPM Socket]
Line 1: Line 1:
 +====== Information ======
  
 +  * phpMyAdmin
 +  * [[Information:Realm of Espionage]]
 +  * https://pma.realmofespionage.xyz ((WAN prohibited))
 +
 +===== Prerequisites =====
 +
 +  * [[Distros:openSUSE Tumbleweed (Server)]]
 +  * [[Servers:MariaDB]]
 +  * [[Servers:nginx+PHP+PHP-FPM|nginx + PHP + PHP-FPM]]
 +  * [[Servers:nginx:Lets Encrypt]]
 +
 +====== Dependencies ======
 +
 +****
 +
 +  sudo zypper install git-core php-composer
 +
 +====== Download Source ======
 +
 +****
 +
 +  sudo git clone -b 'master' 'https://github.com/phpmyadmin/phpmyadmin.git' '/srv/www/phpmyadmin' && sudo chown -R 'nginx':'nginx' '/srv/www/phpmyadmin' && sync
 +
 +===== Composer Dependencies =====
 +
 +  sudo su 'nginx' -s '/bin/bash'
 +
 +  cd '/srv/www/phpmyadmin' && composer update --no-dev && sync && exit
 +
 +====== Database ======
 +
 +  mysql -u 'root' -p < '/srv/www/phpmyadmin/sql/create_tables.sql'
 +
 +  mysql -u 'root' -p
 +
 +  GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* to 'pma'@'localhost' IDENTIFIED BY 'x';
 +
 +====== nginx + PHP-FPM Configuration ======
 +
 +===== PHP-FPM Socket =====
 +
 +  sudo -e '/etc/php7/fpm/php-fpm.d/phpmyadmin.conf' && sudo systemctl restart 'php-fpm'
 +
 +  [phpmyadmin]
 +  user = nginx
 +  group = nginx
 +  listen = /var/lib/nginx/fastcgi/phpmyadmin.sock
 +  listen.owner = nginx
 +  listen.group = nginx
 +  listen.allowed_clients = 127.0.0.1
 +  pm = ondemand
 +  pm.max_children = 8
 +  pm.process_idle_timeout = 10s
 +
 +===== FastCGI =====
 +
 +  sudo -e '/etc/nginx/default.d/phpmyadmin.conf'
 +
 +  location ~ \.php$ {
 +      try_files $uri =404;
 +      include fastcgi.conf;
 +      fastcgi_intercept_errors on;
 +      fastcgi_index index.php;
 +      fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 +      fastcgi_param HTTPS on;
 +      fastcgi_pass unix:/var/lib/nginx/fastcgi/phpmyadmin.sock;
 +  }
 +
 +===== Server Block =====
 +
 +  sudo -e '/etc/nginx/vhosts.d/phpmyadmin.conf' && sudo systemctl reload 'nginx'
 +
 +  server {
 +      listen '443' 'ssl' 'http2';
 +      server_name 'pma.realmofespionage.xyz';
 +      root '/srv/www/phpmyadmin';
 +      index 'index.php';
 +  
 +      include '/etc/nginx/default.d/phpmyadmin.conf';
 +  
 +      #access_log /var/log/nginx/pma-access.log;
 +      #error_log /var/log/nginx/pma-error.log info;
 +  
 +      location / {
 +          allow 192.168.1.0/24;
 +          deny all;
 +      }
 +  }
 +
 +====== Settings ======
 +
 +===== Copy Sample Config =====
 +
 +****
 +
 +  sudo cp '/srv/www/phpmyadmin/config.sample.inc.php' '/srv/www/phpmyadmin/config.inc.php'
 +
 +===== Edit Config =====
 +
 +  * Uncomment the entire **Storage database and tables** section and change the following
 +  * ''blowfish_secret'' can be any randomly generated value (do not reuse ''controlpass'''s password)
 +
 +  sudo -e '/srv/www/phpmyadmin/config.inc.php' && sudo chown 'nginx':'nginx' '/srv/www/phpmyadmin/config.inc.php'
 +
 +  $cfg['blowfish_secret'] = 'x';
 +  
 +  $cfg['Servers'][$i]['connect_type'] = 'socket';
 +  
 +  $cfg['Servers'][$i]['controluser'] = 'pma';
 +  $cfg['Servers'][$i]['controlpass'] = 'x';
 +
 +====== Services ======
 +
 +===== Updater =====
 +
 +==== Service ====
 +
 +  sudo -e '/etc/systemd/system/pma-up.service'
 +
 +  [Service]
 +  User=nginx
 +  Group=nginx
 +  Type=oneshot
 +  ExecStart='/usr/bin/git' -C '/srv/www/phpmyadmin' pull origin 'master'
 +  ExecStart='/usr/bin/composer' update -d '/srv/www/phpmyadmin' --no-dev
 +  ExecStart='/usr/bin/sync'
 +
 +==== Timer ====
 +
 +  sudo -e '/etc/systemd/system/pma-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'pma-up.timer' --now && sudo systemctl start 'pma-up' && sudo systemctl status 'pma-up' -l
 +
 +  [Unit]
 +  Description=phpMyAdmin Git Updater
 +  Wants=network-online.target
 +  
 +  [Timer]
 +  OnCalendar=*-*-* 01:30:00
 +  Persistent=true
 +  
 +  [Install]
 +  WantedBy=timers.target
servers/nginx/phpmyadmin.txt ยท Last modified: 2016/06/26 11:50 by Sean Rhone