Both sides previous revisionPrevious revisionNext revision | Previous revision |
servers:windows:nginx:wordpress [2025/01/07 08:54] – [Settings] Sean Rhone | servers:windows:nginx:wordpress [2025/04/18 11:23] (current) – [PHP-CGI] Sean Rhone |
---|
===== Prerequisites ===== | ===== Prerequisites ===== |
| |
* [[windows:10|Windows 10]] | * [[windows;11_ltsc|Windows 11 (24H2)]] |
* [[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)]] |
| |
* https://www.git-scm.com/download/win | * https://www.git-scm.com/download/win |
* Last tested: ''Git-2.47.0.2-64-bit.exe'' | * Last tested: ''Git-2.48.1-64-bit.exe'' |
| |
* Git from the command line and also from 3rd-party software | * Git from the command line and also from 3rd-party software |
| |
* https://mariadb.org/download/ | * https://mariadb.org/download/ |
* Last tested: ''mariadb-11.6.2-winx64.msi'' | * Last tested: ''mariadb-11.7.2-winx64.msi'' |
| |
* No Development components or Third party tools | * No Development components or Third party tools |
* Use UTF8 as default server's character set | * Use UTF8 as default server's character set |
* [x] Enable Networking | * [x] Enable Networking |
| |
===== PHP 8.3 ===== | |
| |
* https://windows.php.net/download/ | |
* x64 Non Thread Safe | |
* Last tested: ''php-8.3.15-nts-Win32-vs16-x64.zip'' | |
* :!: 2025/01/07: TBA | |
| |
* Extract to root system drive for ''C:\php-8.3.15-nts-Win32-vs16-x64\php-cgi.exe'' | |
| |
explorer "%SystemDrive%" | |
| |
CD "%SystemDrive%\php-8.3"*"-nts-Win32-"*"-x64\" && "php-cgi.exe" -v | |
| |
====== Download Source ====== | ====== Download Source ====== |
* https://github.com/WordPress/WordPress/commits/master/ | * https://github.com/WordPress/WordPress/commits/master/ |
| |
git clone --branch "master" --depth "1" --recurse-submodules "https://github.com/WordPress/WordPress.git" "%SystemDrive%\www\blog" | "%ProgramFiles%\Git\bin\git.exe" clone --branch "master" --depth "1" --recurse-submodules "https://github.com/WordPress/WordPress.git" "%SystemDrive%\www\blog" |
| |
explorer "%SystemDrive%\www\blog" | "explorer.exe" "%SystemDrive%\www\blog" |
| |
====== Database ====== | ====== Database ====== |
| |
"%ProgramFiles%\MariaDB 11.6\bin\mariadb.exe" -u "root" -p | "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p |
| |
CREATE DATABASE wordpress; | CREATE DATABASE wordpress; |
===== PHP ===== | ===== PHP ===== |
| |
notepad "%SystemDrive%\www\php\blog.ini" | "notepad.exe" "%SystemDrive%\www\php\blog.ini" |
| |
<code> | <code> |
| |
; Settings | ; Settings |
| error_reporting = "E_ERROR" |
| display_errors = "Off" |
| |
[Date] | [Date] |
date.timezone = "America/New_York" | date.timezone = "America/New_York" |
; End</code> | ; End</code> |
| |
CD "%SystemDrive%\" && "php.exe" -c "%SystemDrive%\www\php\blog.ini" -m | "php.exe" -c "%SystemDrive%\www\php\blog.ini" -m |
| |
CD "%SystemDrive%\php-8.3"*"-nts-Win32-"*"-x64\" && "php.exe" -c "%SystemDrive%\www\php\blog.ini" -m | |
| |
====== nginx + PHP-CGI Configuration ====== | ====== nginx + PHP-CGI Configuration ====== |
===== PHP-CGI ===== | ===== PHP-CGI ===== |
| |
* :!: ''fastcgi_params'' include hard-coded to nginx version path | "notepad.exe" "%SystemDrive%\www\nginx\default.d\blog.conf" |
| |
notepad "%SystemDrive%\www\nginx\default.d\blog.conf" | |
| |
<code> | <code> |
fastcgi_intercept_errors "on"; | fastcgi_intercept_errors "on"; |
fastcgi_index "index.php"; | fastcgi_index "index.php"; |
include "C:/nginx-1.27.3/conf/fastcgi_params"; | include "C:/www/nginx/conf/fastcgi_params"; |
fastcgi_param "SCRIPT_FILENAME" $document_root$fastcgi_script_name; | fastcgi_param "SCRIPT_FILENAME" $document_root$fastcgi_script_name; |
fastcgi_param "PATH_INFO" $fastcgi_path_info; | fastcgi_param "PATH_INFO" $fastcgi_path_info; |
fastcgi_param "HTTPS" "on"; | fastcgi_param "HTTPS" "on"; |
fastcgi_pass "127.0.0.1:9004"; | fastcgi_pass "127.0.0.1:9004"; |
}</code> | } |
| |
| # End</code> |
| |
===== Server Block ===== | ===== Server Block ===== |
| |
notepad "%SystemDrive%\www\nginx\vhosts.d\blog.conf" | "notepad.exe" "%SystemDrive%\www\nginx\vhosts.d\blog.conf" |
| |
<code> | <code> |
access_log off; log_not_found off; expires max; | access_log off; log_not_found off; expires max; |
} | } |
}</code> | } |
| |
"%SystemDrive%\www\scripts\nginx Reload.bat" | # End</code> |
| |
====== Batch Files ====== | "%SystemDrive%\www\scripts\nginx\Reload.bat" |
| |
| ====== Scripts ====== |
| |
MKDIR "%SystemDrive%\www\scripts\blog" | MKDIR "%SystemDrive%\www\scripts\blog" |
| |
explorer "%SystemDrive%\www\scripts\blog" | "explorer.exe" "%SystemDrive%\www\scripts\blog" |
| |
===== PHP-CGI ===== | ===== PHP-CGI ===== |
| |
notepad "%SystemDrive%\www\scripts\blog\PHP-CGI.bat" | "notepad.exe" "%SystemDrive%\www\scripts\blog\PHP-CGI.bat" |
| |
<code> | <code> |
:: PHP 8.3 | |
::CD "%SystemDrive%\php-8.3"*"-nts-Win32-"*"-x64\" | |
| |
SET "PHP_FCGI_MAX_REQUESTS=0" | SET "PHP_FCGI_MAX_REQUESTS=0" |
SET "PHP_FCGI_CHILDREN=1" | SET "PHP_FCGI_CHILDREN=1" |
| |
"%SystemDrive%\www\scripts\blog\PHP-CGI.bat" | "%SystemDrive%\www\scripts\blog\PHP-CGI.bat" |
| |
==== Autostart ==== | |
| |
explorer "%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp" | |
| |
"%SystemDrive%\www\scripts\blog\PHP-CGI.bat" | |
| |
Blog PHP-CGI | |
| |
===== Update ===== | ===== Update ===== |
| |
* https://github.com/Piwigo/Piwigo/commits/master/ | * https://github.com/WordPress/WordPress/commits/master/ |
* https://github.com/Piwigo/piwigo-bootstrap-darkroom/commits/master/ | |
| |
notepad "%SystemDrive%\www\scripts\media\Update.bat" | "notepad.exe" "%SystemDrive%\www\scripts\blog\Update.bat" |
| |
<code> | <code> |
@echo off | @echo off |
| |
:: Piwigo | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" reset --hard |
"git.exe" -C "%SystemDrive%\www\media" reset --hard | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" pull origin "master" --rebase |
"git.exe" -C "%SystemDrive%\www\media" pull origin "master" --rebase | |
| |
:: Bootstrap Darkroom | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" gc --aggressive --prune="all" |
"git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" reset --hard | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" fsck --full --strict |
"git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" pull origin "master" --rebase | |
| |
pause | |
| |
:: End</code> | :: End</code> |
| |
"%SystemDrive%\www\scripts\media\Update.bat" | "%SystemDrive%\www\scripts\blog\Update.bat" |
| |
===== Maintenance ===== | ====== Shortcuts ====== |
| |
notepad "%SystemDrive%\www\scripts\media\Maintenance.bat" | ===== Desktop ===== |
| |
<code> | "%SystemDrive%\www\scripts\blog\Update.bat" |
@echo off | |
| |
:: Piwigo | Blog Update |
"git.exe" -C "%SystemDrive%\www\media" gc --aggressive --prune="all" | |
"git.exe" -C "%SystemDrive%\www\media" fsck --full --strict | |
| |
:: Bootstrap Darkroom | ===== Autostart ===== |
"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 | "explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp" |
| |
:: End</code> | "%SystemDrive%\www\scripts\blog\PHP-CGI.bat" |
| |
"%SystemDrive%\www\scripts\media\Maintenance.bat" | Blog PHP-CGI |
| |
===== Back-up ===== | |
| |
==== Database ==== | |
| |
notepad "%SystemDrive%\www\scripts\media\Database Back-up.bat" | |
| |
<code> | |
@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</code> | |
| |
"%SystemDrive%\www\scripts\media\Database Back-up.bat" | |
| |
==== Files ==== | |
| |
notepad "%SystemDrive%\www\scripts\media\Files Back-up.bat" | |
| |
<code> | |
@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</code> | |
| |
"%SystemDrive%\www\scripts\media\Files Back-up.bat" | |
| |
====== Initial Setup ====== | ====== Initial Setup ====== |
| |
* https://media.realmofespionage.xyz | * https://blog.realmofespionage.xyz |
| |
====== Settings ====== | ====== Settings ====== |
* https://developer.wordpress.org/advanced-administration/wordpress/update-services/#xml-rpc-ping-services | * https://developer.wordpress.org/advanced-administration/wordpress/update-services/#xml-rpc-ping-services |
| |
===== Page Banner ===== | ===== wp-config.php ===== |
| |
**** | * Add around line 90 ((convenient ''Add any custom values between this line and the "stop editing" line.'')) |
| |
<code> | "notepad.exe" "%SystemDrive%\www\blog\wp-config.php" |
<p>Tech, hardware, food, nature, and gaming pictures and videos!</p></code> | |
| |
===== config.inc.php ===== | <code>define( 'WP_AUTO_UPDATE_CORE', false );</code> |
| |
* [[https://github.com/Piwigo/Piwigo/blob/master/include/config_default.inc.php|More Settings]] | ====== Database ====== |
| |
notepad "%SystemDrive%\www\media\local\config\config.inc.php" | ===== Backup ===== |
| |
<code> | CD "%UserProfile%\Downloads" |
<?php | |
| "%ProgramFiles%\MariaDB 11.7\bin\mariadb-dump.exe" -u "root" -p --opt -r "wordpress.sql" "wordpress" |
| |
| ===== Restore ===== |
| |
// nginx Rewrite | * [[#database|Initial set-up]] |
$conf['question_mark_in_urls'] = false; | |
$conf['php_extension_in_urls'] = false; | |
| |
// Minimal Logging | "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p "wordpress" < "%UserProfile%\Downloads\wordpress.sql" |
$conf['log_level'] = 'EMERGENCY'; | |
| |
// Header Links | "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p --execute="GRANT ALL PRIVILEGES ON wordpress.* to 'wordpress'@'localhost';" |
$conf['links'] = array( | |
'https://realmofespionage.xyz' => 'Realm of Espionage', | |
'https://wiki.realmofespionage.xyz' => 'RoE | Wiki', | |
'https://social.realmofespionage.xyz/profile/espionage724' => 'RoE | Social', | |
'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 | "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p --execute="DROP DATABASE wordpress" |
$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 | "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE wordpress" |
?></code> | |
| |