| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:windows:nginx:piwigo [2026/01/17 08:08] – [TODOs] Sean Rhone | servers:windows:nginx:piwigo [2026/02/01 20:41] (current) – [Albums Formatting] Sean Rhone |
|---|
| ====== Information ====== | ====== Information ====== |
| |
| * Piwigo ((https://piwigo.org/)) | * Piwigo ((https://www.piwigo.org/)) |
| * Bootstrap Darkroom Theme ((https://github.com/Piwigo/piwigo-bootstrap-darkroom)) | * Bootstrap Darkroom Theme ((https://piwigo.org/ext/index.php?eid=831)) ((https://doc.piwigo.org/piwigo-themes/bootstrap-darkroom-theme-piwigo)) |
| * [[Information:Realm of Espionage]] | * [[information;realm_of_espionage|Realm of Espionage]] |
| * https://media.realmofespionage.xyz | * https://media.realmofespionage.xyz |
| |
| ===== Prerequisites ===== | ===== Prerequisites ===== |
| |
| * [[windows;10|Windows 10 (21H2)]] | * [[windows;10_ltsc_server|Windows 10 (21H2)]] |
| * [[servers;windows;nginx_php_php-cgi|nginx + PHP + PHP-CGI]] | * [[servers;windows;nginx_php_php-cgi|nginx + PHP + PHP-CGI]] |
| * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] | * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] |
| ====== Database ====== | ====== Database ====== |
| |
| "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p | "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" |
| |
| CREATE DATABASE piwigo; | CREATE DATABASE piwigo; |
| FLUSH PRIVILEGES;EXIT; | FLUSH PRIVILEGES;EXIT; |
| |
| ====== Environment ====== | ====== nginx + PHP-CGI Configuration ====== |
| |
| ===== PHP ===== | ===== PHP ===== |
| |
| "php.exe" -c "%SystemDrive%\www\php\media.ini" -m | "php.exe" -c "%SystemDrive%\www\php\media.ini" -m |
| |
| ====== nginx + PHP-CGI Configuration ====== | |
| |
| ===== PHP-CGI ===== | ===== PHP-CGI ===== |
| <code> | <code> |
| location "~" "\.(php)(/.*)?$" { | location "~" "\.(php)(/.*)?$" { |
| |
| fastcgi_split_path_info "^(.+\.(?:php))(/.*)$"; | fastcgi_split_path_info "^(.+\.(?:php))(/.*)$"; |
| fastcgi_intercept_errors "on"; | fastcgi_intercept_errors "on"; |
| |
| fastcgi_pass "127.0.0.1:9003"; | fastcgi_pass "127.0.0.1:9003"; |
| | |
| } | } |
| |
| <code> | <code> |
| server { | server { |
| |
| listen "443" "ssl"; | listen "443" "ssl"; |
| http2 "on"; | http2 "on"; |
| rewrite "^/i((/|$).*)$" "/i.php$1" "last"; | rewrite "^/i((/|$).*)$" "/i.php$1" "last"; |
| } | } |
| |
| } | } |
| |
| |
| ====== Scripts ====== | ====== Scripts ====== |
| |
| ===== Folder ===== | |
| |
| MKDIR "%SystemDrive%\www\scripts\media" | MKDIR "%SystemDrive%\www\scripts\media" |
| <code> | <code> |
| @echo off | @echo off |
| | |
| | CD "%Temp%" |
| |
| SET "PHP_FCGI_MAX_REQUESTS=0" | SET "PHP_FCGI_MAX_REQUESTS=0" |
| |
| START "Media PHP-CGI" /MIN "php-cgi.exe" -b "127.0.0.1:9003" -c "%SystemDrive%\www\php\media.ini" -q | START "Media PHP-CGI" /MIN "php-cgi.exe" -b "127.0.0.1:9003" -c "%SystemDrive%\www\php\media.ini" -q |
| | |
| | SET "PHP_FCGI_MAX_REQUESTS=" |
| | SET "PHP_FCGI_CHILDREN=" |
| |
| :: End</code> | :: End</code> |
| |
| TITLE Media Updater | TITLE Media Updater |
| | CD "%Temp%" |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" reset --hard "origin/master" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" reset --hard "origin/master" |
| |
| ===== Back-up ===== | ===== Back-up ===== |
| |
| * ''D:\Servers\Scheduled Backups'' | |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\media\Back-up.bat" | "notepad.exe" "%SystemDrive%\www\scripts\media\Back-up.bat" |
| |
| TITLE Media Back-up | TITLE Media Back-up |
| | CD "%Temp%" |
| |
| :: User\Downloads | |
| ::"tar.exe" -czf "%UserProfile%\Downloads\piwigo-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "media" | |
| ::"%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "%UserProfile%\Downloads\%RANDOM%-piwigo.sql" "piwigo" | |
| |
| :: NAS | |
| "tar.exe" -czf "D:\Servers\Scheduled Backups\piwigo-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "media" | "tar.exe" -czf "D:\Servers\Scheduled Backups\piwigo-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "media" |
| "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "D:\Servers\Scheduled Backups\%RANDOM%-piwigo.sql" "piwigo" | "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "D:\Servers\Scheduled Backups\%RANDOM%-piwigo.sql" "piwigo" |
| | |
| | ::"tar.exe" -czf "%UserProfile%\Downloads\piwigo-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "media" |
| | ::"%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "%UserProfile%\Downloads\%RANDOM%-piwigo.sql" "piwigo" |
| |
| :: End</code> | :: End</code> |
| |
| TITLE Media Maintenance | TITLE Media Maintenance |
| | CD "%Temp%" |
| |
| CALL "%SystemDrive%\www\scripts\media\Git Fix.bat" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" gc --aggressive --prune="all" |
| | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" fsck --full --strict |
| | |
| | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" gc --aggressive --prune="all" |
| | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" fsck --full --strict |
| |
| :: End</code> | :: End</code> |
| ===== Git Fix ===== | ===== Git Fix ===== |
| |
| * :!: Set email for both ''user.email'' | * :!: Set **both** ''user.email'' |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\media\Git Fix.bat" | "notepad.exe" "%SystemDrive%\www\scripts\media\Git Fix.bat" |
| |
| TITLE Media Git Fix | TITLE Media Git Fix |
| | CD "%Temp%" |
| |
| :################### | ::################## |
| :# Piwigo | ::# Piwigo |
| :################### | ::################## |
| |
| RMDIR /S /Q "%SystemDrive%\www\media\.git" | RMDIR /S /Q "%SystemDrive%\www\media\.git" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" add "." | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" add "." |
| |
| :####################################### | ::###################################### |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" config "user.email" "espionage724@x" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" config "user.email" "espionage724@x" |
| :####################################### | ::###################################### |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" commit --message="x" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" commit --message="x" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" fsck --full --strict | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" fsck --full --strict |
| |
| :################### | ::################## |
| :# Bootstrap Darkroom | ::# Bootstrap Darkroom |
| :################### | ::################## |
| |
| RMDIR /S /Q "%SystemDrive%\www\media\themes\bootstrap_darkroom\.git" | RMDIR /S /Q "%SystemDrive%\www\media\themes\bootstrap_darkroom\.git" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" add "." | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" add "." |
| |
| :####################################### | ::###################################### |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" config "user.email" "espionage724@x" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" config "user.email" "espionage724@x" |
| :####################################### | ::###################################### |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" commit --message="x" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" commit --message="x" |
| "%SystemDrive%\www\scripts\media\Git Fix.bat" | "%SystemDrive%\www\scripts\media\Git Fix.bat" |
| |
| ====== Shortcuts ====== | ====== Task Scheduler ====== |
| |
| ===== Autostart ===== | ===== PHP-CGI ===== |
| |
| ==== PHP-CGI ==== | * Auto-start |
| |
| "explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp" | SCHTASKS /Create /SC "ONLOGON" /TN "Media PHP-CGI" /TR "%SystemDrive%\www\scripts\media\PHP-CGI.bat" /F |
| | |
| "%SystemDrive%\www\scripts\media\PHP-CGI.bat" | |
| | |
| Media PHP-CGI | |
| | |
| ====== Task Scheduler ====== | |
| | |
| **** | |
| | |
| taskschd.msc | |
| |
| ===== Update ===== | ===== Update ===== |
| |
| * ''1:00:00 AM'' daily | * Daily ''01:00:00 AM'' |
| |
| Media Update | SCHTASKS /Create /SC "DAILY" /TN "Media Update" /TR "%SystemDrive%\www\scripts\media\Update.bat" /ST "01:00" /F |
| | |
| "%SystemDrive%\www\scripts\media\Update.bat" | |
| | |
| SCHTASKS /Create /SC "ONCE" /TN "Media Update" /TR "%SystemDrive%\www\scripts\media\Update.bat" /ST "01:00" /F | |
| |
| ===== Back-up ===== | ===== Back-up ===== |
| |
| * Monthly -> All months -> Days: ''2'' | * Monthly (2nd) ''01:10:00 AM'' |
| * ''1:15:00 AM'' | |
| |
| Media Back-up | SCHTASKS /Create /SC "MONTHLY" /D "2" /M "*" /TN "Media Back-up" /TR "%SystemDrive%\www\scripts\media\Back-up.bat" /ST "01:10" /F |
| | |
| "%SystemDrive%\www\scripts\media\Back-up.bat" | |
| | |
| SCHTASKS /Create /SC "MONTHLY" /D "2" /M "*" /TN "Media Back-up" /TR "%SystemDrive%\www\scripts\media\Back-up.bat" /ST "01:15" /F | |
| |
| ===== Maintenance ===== | ===== Maintenance ===== |
| |
| * Monthly -> All months -> Days: ''2'' | * Monthly (2nd) ''01:30:00 AM'' |
| * ''1:30:00 AM'' | |
| | |
| Media Maintenance | |
| | |
| "%SystemDrive%\www\scripts\media\Maintenance.bat" | |
| |
| SCHTASKS /Create /SC "MONTHLY" /D "2" /M "*" /TN "Media Maintenance" /TR "%SystemDrive%\www\scripts\media\Maintenance.bat" /ST "01:30" /F | SCHTASKS /Create /SC "MONTHLY" /D "2" /M "*" /TN "Media Maintenance" /TR "%SystemDrive%\www\scripts\media\Maintenance.bat" /ST "01:30" /F |
| ===== config.inc.php ===== | ===== config.inc.php ===== |
| |
| | * [[https://piwigo.org/forum/viewtopic.php?pid=159584#p159584|nginx Rewrite source]] |
| | * [[https://doc.piwigo.org/import-and-manage-photos/file-formats-compatible-piwigo#block-5cef6409208a4b3ead19b930f85942b2|Video Uploading source]] |
| * [[https://github.com/Piwigo/Piwigo/blob/master/include/config_default.inc.php|More Settings]] | * [[https://github.com/Piwigo/Piwigo/blob/master/include/config_default.inc.php|More Settings]] |
| |
| |
| // Hide PHP Warnings | // Hide PHP Warnings |
| $conf['show_php_errors'] = '0'; | $conf['show_php_errors'] = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING; |
| |
| // Header Links | // Header Links |
| $conf['links'] = array( | $conf['links'] = array( |
| 'https://realmofespionage.xyz' => 'Realm of Espionage', | 'https://realmofespionage.xyz' => 'Realm of Espionage', |
| 'https://wiki.realmofespionage.xyz' => 'RoE | Wiki', | 'https://wiki.realmofespionage.xyz/start' => 'RoE | Wiki', |
| 'https://blog.realmofespionage.xyz' => 'RoE | Blog', | 'https://blog.realmofespionage.xyz/' => 'RoE | Blog', |
| | 'https://social.realmofespionage.xyz/profile/espionage724' => 'RoE | Social', |
| | 'https://forums.realmofespionage.xyz/' => 'RoE | Forums', |
| | 'https://status.realmofespionage.xyz/' => 'RoE | Status', |
| 'https://wiki.realmofespionage.xyz/user;espionage724' => 'Webmaster Info', | 'https://wiki.realmofespionage.xyz/user;espionage724' => 'Webmaster Info', |
| 'https://wiki.realmofespionage.xyz/servers;windows;nginx;piwigo' => 'Instance Configuration Notes', | 'https://wiki.realmofespionage.xyz/servers;windows;nginx;piwigo' => 'Instance Configuration Notes', |
| // Video Uploading | // Video Uploading |
| $conf['upload_form_all_types'] = true; | $conf['upload_form_all_types'] = true; |
| | |
| $conf['file_ext'] = array_merge( | $conf['file_ext'] = array_merge( |
| $conf['picture_ext'], | $conf['picture_ext'], |
| array('tiff', 'tif', 'mpg','zip','avi','mp3','ogg','pdf','webm','mp4') | array('mp4','webmv','m4v','webm','mov') |
| ); | ); |
| |
| ?></code> | ?></code> |
| |
| ====== Albums Formatting ====== | ===== database.inc.php ===== |
| |
| ===== 4 Links ===== | * :!: Change ''db_password'' |
| |
| * https://media.realmofespionage.xyz/index/category/2 | "notepad.exe" "%SystemDrive%\www\media\local\config\config.inc.php" |
| |
| <code> | <code> |
| <a href="https://wiki.realmofespionage.xyz/games;windows;2004scape_localhost" target="_blank" rel="noopener">Windows</a> | <a href="https://wiki.realmofespionage.xyz/games;linux;2004scape_localhost" target="_blank" rel="noopener">Linux</a> | <a href="https://wiki.realmofespionage.xyz/games;bsd;2004scape_localhost" target="_blank" rel="noopener">FreeBSD</a> | <a href="https://lostcity.rs/t/singleplayer-main-branch-scripts-and-desktop-start-launchers-on-windows-linux-freebsd/54" target="_blank" rel="noopener">Lost City Forums</a> | <?php |
| </code> | $conf['dblayer'] = 'mysqli'; |
| | $conf['db_base'] = 'piwigo'; |
| | $conf['db_user'] = 'piwigo'; |
| | $conf['db_password'] = 'x'; |
| | $conf['db_host'] = 'localhost'; |
| |
| ===== Single Link ===== | $prefixeTable = 'piwigo_'; |
| |
| * https://media.realmofespionage.xyz/picture/268/category/17 | define('PHPWG_INSTALLED', true); |
| | define('PWG_CHARSET', 'utf-8'); |
| | define('DB_CHARSET', 'utf8'); |
| | define('DB_COLLATE', ''); |
| |
| <code> | ?></code> |
| <a href="https://wiki.realmofespionage.xyz/games;windows;dota_2_steamcmd" target="_blank" rel="noopener">Notes</a> | |
| </code> | |
| |
| ====== Files ====== | ====== Backup ====== |
| |
| ===== Backup ===== | ===== Folder ===== |
| |
| **** | **** |
| "tar.exe" -czf "%UserProfile%\Downloads\piwigo-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "media" | "tar.exe" -czf "%UserProfile%\Downloads\piwigo-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "media" |
| |
| ====== Database ====== | ===== Database ===== |
| | |
| ===== Backup ===== | |
| |
| **** | **** |
| |
| CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" -p --opt -r "piwigo.sql" "piwigo" | CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "piwigo.sql" "piwigo" |
| |
| ===== Restore ===== | ====== Restore ====== |
| | |
| | ===== Database ===== |
| |
| * [[#database|Initial set-up]] | * [[#database|Initial set-up]] |
| |
| "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE piwigo" | "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" --execute="CREATE DATABASE piwigo" |
| |
| "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p "piwigo" < "%UserProfile%\Downloads\piwigo.sql" | "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" "piwigo" < "%UserProfile%\Downloads\piwigo.sql" |
| |
| ====== TODOs ====== | ====== Resources ====== |
| |
| * Show title on pictures (long titles get cut-off in navbar) | ===== Albums Formatting ===== |
| * 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]]) | |
| |
| ===== Auth File ===== | * :!: Using Emojis (like 8-) from [[https://emojipedia.org/smiling-face-with-sunglasses|Emojipedia]]) in comments causes MySQL exception |
| |
| MKDIR "%SystemDrive%\www\mariadb\auth" | ==== 4 Links ==== |
| |
| "notepad.exe" "%SystemDrive%\www\mariadb\auth\piwigo.cnf" | * https://media.realmofespionage.xyz/index/category/2 |
| |
| <code> | <code> |
| [mariadb-dump] | <a href="https://wiki.realmofespionage.xyz/games;windows;2004scape_localhost" target="_blank" rel="noopener">Windows</a> | <a href="https://wiki.realmofespionage.xyz/games;linux;2004scape_localhost" target="_blank" rel="noopener">Linux</a> | <a href="https://wiki.realmofespionage.xyz/games;bsd;2004scape_localhost" target="_blank" rel="noopener">FreeBSD</a> | <a href="https://lostcity.rs/t/singleplayer-main-branch-scripts-and-desktop-start-launchers-on-windows-linux-freebsd/54" target="_blank" rel="noopener">Lost City Forums</a> |
| user=piwigo | </code> |
| password=x | |
| |
| # End</code> | ==== Single Link ==== |
| |
| ICACLS "%SystemDrive%\www\mariadb\auth\piwigo.cnf" /grant:"r" "MariaDB:R" | * https://media.realmofespionage.xyz/picture/268/category/17 |
| |
| ICACLS "%SystemDrive%\www\mariadb\auth\piwigo.cnf" /inheritance:"r" | <code> |
| | <a href="https://wiki.realmofespionage.xyz/games;windows;dota_2_steamcmd" target="_blank" rel="noopener">Notes</a> |
| | </code> |
| | |
| | ====== TODO ====== |
| | |
| | * Show title on pictures (long titles get cut-off in navbar) |
| |