User Tools

Site Tools


servers:windows:nginx:lychee

Information

Prerequisites

Dependencies

Git

  • Git from the command line and also from 3rd-party software

Node.js

  • Node.js runtime, npm package manager, Add to PATH (corepack manager and Online documentation not required)
  • Tools for Native Modules not required (leave “Automatically install the tools” unchecked)

Download Source

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

Environment

PHP

notepad "%SystemDrive%\www\php\media.ini"
[PHP]
; Modules
extension_dir = ".\ext"
extension = "exif"
extension = "fileinfo"
extension = "gd"
extension = "mbstring"
extension = "openssl"
extension = "sqlite3"
extension = "sodium"
zend_extension = "opcache"

; Settings
post_max_size = "100M"
upload_max_filesize = "100M"

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

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

Lychee

notepad "%SystemDrive%\www\media\.env"
APP_URL="https://media.realmofespionage.xyz"

Dependencies

Composer

MKDIR "%SystemDrive%\www\ext"
explorer "%SystemDrive%\www\ext"
CD "%SystemDrive%\www\media" && "php.exe" -c "%SystemDrive%\www\php\media.ini" "%SystemDrive%\www\ext\composer.phar" install --no-dev

Node.js

CD "%SystemDrive%\www\media" && npm ci --verbose
CD "%SystemDrive%\www\media" && npm run "build" --verbose

freenginx + PHP-CGI Configuration

PHP-CGI

  • :!: fastcgi_params include hard-coded to freenginx version path
notepad "%SystemDrive%\www\nginx\default.d\media.conf"
# PHP-CGI
location ~ \.(php)(/.*)?$ {
    fastcgi_split_path_info ^(.+\.(?:php))(/.*)$;
    fastcgi_intercept_errors "on";
    fastcgi_index "index.php";
    include "C:/freenginx-1.27.4/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 "%SystemDrive%\www\nginx\vhosts.d\media.conf"
server {
    listen "443" "ssl";
    http2 "on";
    server_name "media.realmofespionage.xyz";
    root "C:/www/media/public";
    index "index.php";

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

    client_max_body_size "100M";

#    add_header Content-Security-Policy "default-src "self"; script-src "self" "unsafe-inline" "unsafe-eval"; style-src "self" "unsafe-inline"" always;

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

    if (!-e $request_filename)
    {
        rewrite ^/(.*)$ /index.php?/$1 last;
        break;
    }

    location ~ [^/]\.php(/|$) {
        return 403;
    }

    rewrite ^/(.+)/$ /$1 permanent;
}

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

Batch Files

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

PHP-CGI

notepad "%SystemDrive%\www\scripts\media\PHP-CGI.bat"
SET "PHP_FCGI_MAX_REQUESTS=0"
SET "PHP_FCGI_CHILDREN=1"

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

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

Autostart

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

Update

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

:: Piwigo
"git.exe" -C "%SystemDrive%\www\media" reset --hard
"git.exe" -C "%SystemDrive%\www\media" pull origin "master" --rebase

:: Bootstrap Darkroom
"git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" reset --hard
"git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" pull origin "master" --rebase

pause

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

Maintenance

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

:: Piwigo
"git.exe" -C "%SystemDrive%\www\media" gc --aggressive --prune="all"
"git.exe" -C "%SystemDrive%\www\media" fsck --full --strict

:: Bootstrap Darkroom
"git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" gc --aggressive --prune="all"
"git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" fsck --full --strict

pause

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

Back-up

Database

notepad "%SystemDrive%\www\scripts\media\Database Back-up.bat"
@echo off

:: User\Downloads
CD "%UserProfile%\Downloads"

:: NAS
::CD /D "D:\Servers\Scheduled Backups"

echo Root MariaDB user password prompt:
"%ProgramFiles%\MariaDB 11.6\bin\mariadb-dump.exe" -u "root" -p --opt -r "piwigo-database-%RANDOM%.sql" "piwigo"

pause

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

Files

notepad "%SystemDrive%\www\scripts\media\Files Back-up.bat"
@echo off

CD "%SystemDrive%\www"

echo Backing up files...

:: User\Downloads
tar -czf "%UserProfile%\Downloads\piwigo-files-auto-%RANDOM%.tar.gz" "media"

:: NAS
::tar -czf "D:\Servers\Scheduled Backups\piwigo-files-auto-%RANDOM%.tar.gz" "media"

pause

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

Initial Setup

Settings

  • :!: Disable Allow user registration immediately under Configuration → Options → General → Permissions
  • Activate Boostrap Darkroom theme

Page Banner

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

config.inc.php

notepad "%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';

// 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
?>
/srv/www/wiki/data/pages/servers/windows/nginx/lychee.txt · Last modified: by Sean Rhone