Both sides previous revisionPrevious revisionNext revision | Previous revision |
servers:windows:nginx:wordpress [2025/01/17 15:13] – 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;freenginx_php_php-cgi|freenginx + 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.1.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 |
"%ProgramFiles%\Git\bin\git.exe" 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> |
; End</code> | ; End</code> |
| |
CD "%SystemDrive%\" && "php.exe" -c "%SystemDrive%\www\php\blog.ini" -m | "php.exe" -c "%SystemDrive%\www\php\blog.ini" -m |
| |
====== freenginx + PHP-CGI Configuration ====== | ====== nginx + PHP-CGI Configuration ====== |
| |
===== PHP-CGI ===== | ===== PHP-CGI ===== |
| |
* :!: ''fastcgi_params'' include hard-coded to freenginx 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:/freenginx-1.27.4/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\freenginx\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> |
| |
"%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/WordPress/WordPress/commits/master/ | * https://github.com/WordPress/WordPress/commits/master/ |
| |
notepad "%SystemDrive%\www\scripts\blog\Update.bat" | "notepad.exe" "%SystemDrive%\www\scripts\blog\Update.bat" |
| |
<code> | <code> |
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" reset --hard | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" reset --hard |
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" pull origin "master" --rebase | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" pull origin "master" --rebase |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" gc --aggressive --prune="all" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" fsck --full --strict |
| |
:: End</code> | :: End</code> |
| |
===== Maintenance ===== | "%SystemDrive%\www\scripts\blog\Update.bat" |
| |
notepad "%SystemDrive%\www\scripts\blog\Maintenance.bat" | ====== Shortcuts ====== |
| |
<code> | ===== Desktop ===== |
@echo off | |
| |
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" gc --aggressive --prune="all" | "%SystemDrive%\www\scripts\blog\Update.bat" |
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" fsck --full --strict | |
| |
:: End</code> | Blog Update |
| |
| ===== Autostart ===== |
| |
| "explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp" |
| |
| "%SystemDrive%\www\scripts\blog\PHP-CGI.bat" |
| |
| Blog PHP-CGI |
| |
====== Initial Setup ====== | ====== Initial Setup ====== |
* Add around line 90 ((convenient ''Add any custom values between this line and the "stop editing" line.'')) | * Add around line 90 ((convenient ''Add any custom values between this line and the "stop editing" line.'')) |
| |
notepad "%SystemDrive%\www\blog\wp-config.php" | "notepad.exe" "%SystemDrive%\www\blog\wp-config.php" |
| |
<code>define( 'WP_AUTO_UPDATE_CORE', false );</code> | <code>define( 'WP_AUTO_UPDATE_CORE', false );</code> |
| |
| ====== Database ====== |
| |
| ===== Backup ===== |
| |
| CD "%UserProfile%\Downloads" |
| |
| "%ProgramFiles%\MariaDB 11.7\bin\mariadb-dump.exe" -u "root" -p --opt -r "wordpress.sql" "wordpress" |
| |
| ===== Restore ===== |
| |
| * [[#database|Initial set-up]] |
| |
| "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p "wordpress" < "%UserProfile%\Downloads\wordpress.sql" |
| |
| "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p --execute="GRANT ALL PRIVILEGES ON wordpress.* to 'wordpress'@'localhost';" |
| |
| "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p --execute="DROP DATABASE wordpress" |
| |
| "%ProgramFiles%\MariaDB 11.7\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE wordpress" |
| |