User Tools

Site Tools


servers:windows:nginx:piwigo

Information

Prerequisites

Dependencies

Download Source

"%ProgramFiles%\Git\bin\git.exe" clone --branch "master" --depth "1" --recurse-submodules "https://github.com/Piwigo/Piwigo.git" "%SystemDrive%\www\media"

Bootstrap Darkroom

"%ProgramFiles%\Git\bin\git.exe" clone --branch "master" --depth "1" --recurse-submodules "https://github.com/Piwigo/piwigo-bootstrap-darkroom.git" "%SystemDrive%\www\media\themes\bootstrap_darkroom"

Database

"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p
CREATE DATABASE piwigo;
CREATE USER 'piwigo'@'localhost' IDENTIFIED BY 'x';
GRANT ALL PRIVILEGES ON piwigo.* to 'piwigo'@'localhost';
FLUSH PRIVILEGES;EXIT;

Environment

PHP

"notepad.exe" "%SystemDrive%\www\php\media.ini"
[PHP]
extension_dir = ".\ext"
extension = "exif"
extension = "gd"
extension = "mbstring"
extension = "mysqli"

error_reporting = "~E_ALL"
display_errors = "Off"
log_errors = "Off"

post_max_size = "100M"
upload_max_filesize = "100M"

[Date]
date.timezone = "America/New_York"

; End
"php.exe" -c "%SystemDrive%\www\php\media.ini" -m

nginx + PHP-CGI Configuration

PHP-CGI

"notepad.exe" "%SystemDrive%\www\nginx\default.d\media.conf"
location "~" "\.(php)(/.*)?$" {

 fastcgi_split_path_info "^(.+\.(?:php))(/.*)$";
 fastcgi_intercept_errors "on";
 fastcgi_index "index.php";
 include "C:/www/nginx/conf/fastcgi_params";
 fastcgi_param "SCRIPT_FILENAME" "$document_root$fastcgi_script_name";
 fastcgi_param "PATH_INFO" "$fastcgi_path_info";
 fastcgi_param "HTTPS" "on";

 fastcgi_pass "127.0.0.1:9003";
 
}

# End

Server Block

"notepad.exe" "%SystemDrive%\www\nginx\vhosts.d\media.conf"
server {

 listen "443" "ssl";
 http2 "on";
 server_name "media.realmofespionage.xyz";
 root "C:/www/media";
 index "index.php";

 include "C:/www/nginx/default.d/media.conf";
 include "C:/www/nginx/default.d/headers.conf";

 client_max_body_size "100M";

# access_log "logs/media-access.log";
# error_log "logs/media-error.log";

 location "/" {
  index "index.php";
  try_files "$uri $uri/" "@rewrite";
 }

 location "@rewrite" {
  rewrite "^/picture((/|$).*)$" "/picture.php$1" "last";
  rewrite "^/index((/|$).*)$" "/index.php$1" "last";
  rewrite "^/i((/|$).*)$" "/i.php$1" "last";
 }

}

# End
"%SystemDrive%\www\scripts\nginx\Reload.bat"

Scripts

Folder

MKDIR "%SystemDrive%\www\scripts\media"
"explorer.exe" "%SystemDrive%\www\scripts\media"

PHP-CGI

"notepad.exe" "%SystemDrive%\www\scripts\media\PHP-CGI.bat"
@echo off

SET "PHP_FCGI_MAX_REQUESTS=0"
SET "PHP_FCGI_CHILDREN=1"

START "Media PHP-CGI" /MIN "php-cgi.exe" -b "127.0.0.1:9003" -c "%SystemDrive%\www\php\media.ini" -q

:: End
"%SystemDrive%\www\scripts\media\PHP-CGI.bat"

Update

"notepad.exe" "%SystemDrive%\www\scripts\media\Update.bat"
@echo off

TITLE Media Updater

"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" reset --hard "origin/master"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" pull origin "master" --rebase

"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" reset --hard "origin/master"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" pull origin "master" --rebase

:: End
"%SystemDrive%\www\scripts\media\Update.bat"

Back-up

  • D:\Servers\Scheduled Backups
"notepad.exe" "%SystemDrive%\www\scripts\media\Back-up.bat"
@echo off

TITLE Media Back-up

:: 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"
"%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "D:\Servers\Scheduled Backups\%RANDOM%-piwigo.sql" "piwigo"

:: End
"%SystemDrive%\www\scripts\media\Back-up.bat"

Maintenance

"notepad.exe" "%SystemDrive%\www\scripts\media\Maintenance.bat"
@echo off

TITLE Media Maintenance

CALL "%SystemDrive%\www\scripts\media\Git Fix.bat"

:: End
"%SystemDrive%\www\scripts\media\Maintenance.bat"

Git Fix

  • :!: Set email for both user.email
"notepad.exe" "%SystemDrive%\www\scripts\media\Git Fix.bat"
@echo off

TITLE Media Git Fix

RMDIR /S /Q "%SystemDrive%\www\media\.git"

"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" init --initial-branch="master"
"%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" commit --message="x"

"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" remote add "origin" "https://github.com/Piwigo/Piwigo.git"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" pull --depth "1" --recurse-submodules "origin" "master" --rebase
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" reset --hard "origin/master"

"%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

RMDIR /S /Q "%SystemDrive%\www\media\themes\bootstrap_darkroom\.git"

"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" init --initial-branch="master"
"%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" commit --message="x"

"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" remote add "origin" "https://github.com/Piwigo/piwigo-bootstrap-darkroom.git"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" pull --depth "1" --recurse-submodules "origin" "master" --rebase
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" reset --hard "origin/master"

"%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
"%SystemDrive%\www\scripts\media\Git Fix.bat"

Shortcuts

Autostart

PHP-CGI

"explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp"
"%SystemDrive%\www\scripts\media\PHP-CGI.bat"
Media PHP-CGI

Task Scheduler

taskschd.msc

Update

  • 1:00:00 AM daily
Media Update
"%SystemDrive%\www\scripts\media\Update.bat"

Back-up

  • Monthly → All months → Days: 2
  • 1:15:00 AM
Media Back-up
"%SystemDrive%\www\scripts\media\Back-up.bat"

Maintenance

  • Monthly → All months → Days: 2
  • 1:30:00 AM
Media Maintenance
"%SystemDrive%\www\scripts\media\Maintenance.bat"

Initial Setup

Settings

  • :!: Disable Allow user registration immediately under Configuration → Options → General → Permissions
  • Activate Boostrap Darkroom theme
  • Default photos order: Numeric identifier, 9 → 1

Page Banner

<p>Tech, hardware, food, nature, and gaming pictures and videos!</p>

config.inc.php

"notepad.exe" "%SystemDrive%\www\media\local\config\config.inc.php"
<?php

// nginx Rewrite
$conf['question_mark_in_urls'] = false;
$conf['php_extension_in_urls'] = false;

// Minimal Logging
$conf['log_level'] = 'EMERGENCY';

// Hide PHP Warnings
$conf['show_php_errors'] = '0';

// Header Links
$conf['links'] = array(
  'https://realmofespionage.xyz' => 'Realm of Espionage',
  'https://wiki.realmofespionage.xyz' => 'RoE | Wiki',
  'https://blog.realmofespionage.xyz' => 'RoE | Blog',
  'https://wiki.realmofespionage.xyz/user;espionage724' => 'Webmaster Info',
  'https://wiki.realmofespionage.xyz/servers;windows;nginx;piwigo' => 'Instance Configuration Notes',
  );

// Video Uploading
$conf['upload_form_all_types'] = true;
$conf['file_ext'] = array_merge(
  $conf['picture_ext'],
  array('tiff', 'tif', 'mpg','zip','avi','mp3','ogg','pdf','webm','mp4')
  );

// End
?>

Albums Formatting

<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>
<a href="https://wiki.realmofespionage.xyz/games;windows;dota_2_steamcmd" target="_blank" rel="noopener">Notes</a>

Files

Backup

"tar.exe" -czf "%UserProfile%\Downloads\piwigo-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "media"

Database

Backup

CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" -p --opt -r "piwigo.sql" "piwigo"

Restore

"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE piwigo"
"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p "piwigo" < "%UserProfile%\Downloads\piwigo.sql"

TODOs

/var/www/wiki/data/pages/servers/windows/nginx/piwigo.txt · Last modified: by Sean Rhone

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki