User Tools

Site Tools


servers:linux:nginx:piwigo

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
servers:linux:nginx:piwigo [2025/07/16 12:43] – openSUSE TW WIP Sean Rhoneservers:linux:nginx:piwigo [2025/08/27 20:15] (current) Sean Rhone
Line 5: Line 5:
   * [[Information:Realm of Espionage]]   * [[Information:Realm of Espionage]]
   * https://media.realmofespionage.xyz   * https://media.realmofespionage.xyz
 +
 +===== TODOs =====
 +
 +  * Show title on pictures (long titles get cut-off in navbar)
 +  * AI ([[https://piwigo.org/forum/viewtopic.php?pid=192438#p192438|post]], [[https://github.com/Piwigo/Piwigo/commits/master/include/config_default.inc.php|config.inc.php]])
  
 ===== Prerequisites ===== ===== Prerequisites =====
  
   * [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (Server)]]   * [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (Server)]]
-  * [[servers:mariadb|MariaDB]] 
   * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]]   * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]]
   * [[servers;linux;nginx;lets_encrypt|Certbot (Let's Encrypt)]]   * [[servers;linux;nginx;lets_encrypt|Certbot (Let's Encrypt)]]
 +  * [[servers:linux:mariadb|MariaDB]]
  
 ====== Dependencies ====== ====== Dependencies ======
Line 39: Line 44:
   CREATE DATABASE piwigo;   CREATE DATABASE piwigo;
  
-  GRANT ALL PRIVILEGES ON piwigo.* to 'piwigo'@'localhost' IDENTIFIED BY 'x';+  CREATE USER 'piwigo'@'localhost' IDENTIFIED BY 'x'; 
 + 
 +  GRANT ALL PRIVILEGES ON piwigo.* to 'piwigo'@'localhost';
  
   FLUSH PRIVILEGES;   FLUSH PRIVILEGES;
Line 49: Line 56:
 ===== PHP-FPM Socket ===== ===== PHP-FPM Socket =====
  
-  sudo -e '/etc/php-fpm.d/media.conf' && sudo systemctl restart 'php-fpm'+  sudo -e '/etc/php8/fpm/php-fpm.d/media.conf' && sudo systemctl restart 'php-fpm'
  
 <code> <code>
Line 83: Line 90:
  
 ===== FastCGI ===== ===== FastCGI =====
 +
 +  * ''media.sock''
  
   sudo -e '/etc/nginx/default.d/media.conf'   sudo -e '/etc/nginx/default.d/media.conf'
  
 <code> <code>
-# PHP-FPM 
 location ~ \.(php|phar)(/.*)?$ { location ~ \.(php|phar)(/.*)?$ {
     fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;     fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;
Line 96: Line 104:
     fastcgi_param PATH_INFO $fastcgi_path_info;     fastcgi_param PATH_INFO $fastcgi_path_info;
     fastcgi_pass unix:/run/php-fpm/media.sock;     fastcgi_pass unix:/run/php-fpm/media.sock;
-}</code>+} 
 + 
 +# End</code>
  
 ===== Server Block ===== ===== Server Block =====
Line 336: Line 346:
 WantedBy=timers.target</code> WantedBy=timers.target</code>
  
-====== Backup ======+====== Old Restore ======
  
-  * Create backup archive on server and transfer to client computer+===== Client =====
  
-===== Server =====+==== Uncompress Database ====
  
-==== Stop Services ====+  * This is only needed if restoring an **automated** database backup ((manual doesn't gzip))
  
-****+  gunzip ~/'Downloads/piwigo-database-'*'.sql.gz'
  
-  sudo systemctl stop nginx php-fpm+====== Files ======
  
-==== Backup Folder ====+===== Backup =====
  
 **** ****
  
-  cd '/var/www' && sudo tar -cvzf ~/'piwigo-files-manual-'$(date +%Y-%m-%d)'.tar.gz' 'media' && cd ~ && sync+  sudo tar -czf ~/'piwigo-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/srv/www' 'media'
  
-==== Backup Database ====+===== scp =====
  
-****+==== To Client Backup ====
  
-  sudo mariadb-dump --defaults-extra-file='/var/lib/mysql/auth/piwigo' --single-transaction 'piwigo' -r ~/'piwigo-database-manual-'$(date +%Y-%m-%d)'.sql' && sync+  * Server back-up -> Client 
 +  * Run on server
  
-==== Start Services ====+  scp espionage724@192.168.1.152:~/'piwigo-files-'*'.tar.gz' ~/'Downloads'
  
-****+==== To Server Restore ====
  
-  sudo systemctl start nginx php-fpm+  * Client -> (files) -> Server 
 +  * Run on client
  
-===== Client =====+  scp ~/'Downloads/piwigo-files-'*'.tar.gz' espionage724@192.168.1.152:~
  
-==== Transfer Files To Client ====+===== Restore =====
  
 **** ****
  
-  scp espionage724@192.168.1.152:~/'piwigo-files-'*'.tar.gz' espionage724@192.168.1.152:~/'piwigo-database-'*'.sql~/'Downloads' && sync+  sudo rm -Rf '/srv/www/media' && sudo tar -xzf ~/'piwigo-files-'*'.tar.gz' -C '/srv/www'media' && sudo chown -'wwwrun':'www'/srv/www/media' && sync
  
-====== Restore ====== +===== Clean-up =====
- +
-===== Client ===== +
- +
-==== Uncompress Database ==== +
- +
-  * This is only needed if restoring an **automated** database backup ((manual doesn't gzip)) +
- +
-  gunzip ~/'Downloads/piwigo-database-'*'.sql.gz' +
- +
-===Transfer Files To Server ====+
  
 **** ****
  
-  scp ~/'Downloads/piwigo-files-'*'.tar.gz' ~/'Downloads/piwigo-database-'*'.sql' espionage724@192.168.1.152:~+  rm -fv ~/'piwigo-files-'*'.tar.gz'
  
-==== Remove Files ====+====== Database ======
  
-**** +===== Backup =====
- +
-  rm -f ~/'Downloads/piwigo-files-'*'.tar.gz' ~/'Downloads/piwigo-database-'*'.sql' && sync +
- +
-===== Server ===== +
- +
-==== Stop Services ====+
  
 **** ****
  
-  sudo systemctl stop nginx php-fpm+  sudo mariadb-dump --single-transaction --quick 'piwigo' -r ~/'piwigo-database-manual-'$(date +%Y-%m-%d)'.sql'
  
-==== Remove Previous Folder ====+===== scp =====
  
-****+==== To Client Backup ====
  
-  sudo rm -Rf '/var/www/media'+  * Server back-up -> Client 
 +  * Run on server
  
-==== Restore Piwigo Folder ====+  scp espionage724@192.168.1.152:~/'piwigo-database-'*'.sql' ~/'Downloads'
  
-****+==== To Server Restore ====
  
-  cd '/var/www' && sudo tar -xvzf ~/'piwigo-files-'*'.tar.gz' 'media' && sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' '/var/www/media(/.*)?' && sudo restorecon -F -I -R '/var/www/media' && sudo chown -R 'nginx':'nginx' '/var/www/media' && cd ~ && sync+  * Client -(files) -> Server 
 +  * Run on client
  
-==== Drop Previous Database ====+  scp ~/'Downloads/piwigo'*'.sql' espionage724@192.168.1.152:~
  
-  sudo mariadb+===== Restore =====
  
-  DROP DATABASE piwigo;+  sudo mariadb --execute='CREATE DATABASE piwigo'
  
-  FLUSH TABLES;+  sudo mariadb 'piwigo' < ~/'piwigo'*'.sql'
  
-  EXIT +==== Permissions ====
- +
-==== Re-create Databases ====+
  
   sudo mariadb   sudo mariadb
  
-  CREATE DATABASE piwigo;+  CREATE USER 'piwigo'@'localhost' IDENTIFIED BY 'x';
  
-  EXIT +  GRANT ALL PRIVILEGES ON piwigo.* to 'piwigo'@'localhost';
- +
-==== Restore Database ==== +
- +
-**** +
- +
-  sudo mariadb 'piwigo' < ~/'piwigo-database-'*'.sql' && sync +
- +
-==== Reapply Permissions ==== +
- +
-  sudo mariadb +
- +
-  GRANT ALL PRIVILEGES ON piwigo.* to 'piwigo'@'localhost' IDENTIFIED BY 'x';+
  
   FLUSH PRIVILEGES;   FLUSH PRIVILEGES;
Line 450: Line 434:
   EXIT   EXIT
  
-==== Start Services ====+===== Clean-up =====
  
 **** ****
  
-  sudo systemctl start nginx php-fpm +  rm -fv ~/'piwigo'*'.sql'
- +
-==== Remove Backups ==== +
- +
-  * Verify that Piwigo works before running +
- +
-  rm ~/'piwigo-files-'*'.tar.gz' ~/'piwigo-database-'*'.sql' && sync+
  
/usr/local/www/wiki/data/attic/servers/linux/nginx/piwigo.1752684188.txt.gz · Last modified: by Sean Rhone