servers:windows:nginx:wordpress
This is an old revision of the document!
Table of Contents
Information
Prerequisites
Dependencies
Download Source
"%ProgramFiles%\Git\bin\git.exe" clone --branch "master" --depth "1" --recurse-submodules "https://github.com/WordPress/WordPress.git" "%SystemDrive%\www\blog"
Database
"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p
CREATE DATABASE wordpress;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'x';
GRANT ALL PRIVILEGES ON wordpress.* to 'wordpress'@'localhost';
FLUSH PRIVILEGES;EXIT;
Environment
PHP
"notepad.exe" "%SystemDrive%\www\php\blog.ini"
[PHP] extension_dir = ".\ext" extension = "curl" extension = "exif" extension = "fileinfo" extension = "gd" extension = "intl" extension = "mbstring" extension = "mysqli" extension = "openssl" extension = "sodium" error_reporting = "~E_ALL" display_errors = "Off" [Date] date.timezone = "America/New_York" ; End
"php.exe" -c "%SystemDrive%\www\php\blog.ini" -m
nginx + PHP-CGI Configuration
PHP-CGI
"notepad.exe" "%SystemDrive%\www\nginx\default.d\blog.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:9004";
}
# End
Themes Deny
- Deny all except
twentytwentyfive
"notepad.exe" "%SystemDrive%\www\nginx\default.d\wp-themes-deny.conf"
location "~" "/wp-content/themes/(twentyeleven|twentyfifteen|twentyfourteen|twentynineteen|twentyseventeen|twentysixteen|twentyten|twentythirteen|twentytwelve|twentytwentyfour|twentytwentyone|twentytwentythree|twentytwentytwo|twentytwenty)/" {
deny "all";
}
# End
Server Block
"notepad.exe" "%SystemDrive%\www\nginx\vhosts.d\blog.conf"
server {
listen "443" "ssl";
http2 "on";
server_name "blog.realmofespionage.xyz";
root "C:/www/blog";
index "index.php";
include "C:/www/nginx/default.d/blog.conf";
include "C:/www/nginx/default.d/headers.conf";
include "C:/www/nginx/default.d/wp-themes-deny.conf";
client_max_body_size "10M";
# access_log "logs/blog-access.log";
# error_log "logs/blog-error.log";
location "/" {
try_files "$uri" "$uri/" "/index.php?$args";
}
rewrite "/wp-admin$" "$scheme://$host$uri/" "permanent";
}
# End
"%SystemDrive%\www\scripts\nginx\Reload.bat"
Scripts
MKDIR "%SystemDrive%\www\scripts\blog"
PHP-CGI
"notepad.exe" "%SystemDrive%\www\scripts\blog\PHP-CGI.bat"
SET "PHP_FCGI_MAX_REQUESTS=0" SET "PHP_FCGI_CHILDREN=1" START "Blog PHP-CGI" "php-cgi.exe" -b "127.0.0.1:9004" -c "%SystemDrive%\www\php\blog.ini" -q :: End
"%SystemDrive%\www\scripts\blog\PHP-CGI.bat"
Update
"notepad.exe" "%SystemDrive%\www\scripts\blog\Update.bat"
@echo off TITLE Blog Updater "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" reset --hard "origin/master" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" pull origin "master" --rebase :: End
"%SystemDrive%\www\scripts\blog\Update.bat"
Back-up
TODO
"notepad.exe" "%SystemDrive%\www\scripts\media\Back-up.bat"
@echo off :: User\Downloads "tar.exe" -czf "%UserProfile%\Downloads\dokuwiki-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www\wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf" :: NAS ::"tar.exe" -czf "D:\Servers\Scheduled Backups\dokuwiki-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www\wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf" :: End
"%SystemDrive%\www\scripts\media\Back-up.bat"
Maintenance
"notepad.exe" "%SystemDrive%\www\scripts\blog\Maintenance.bat"
@echo off TITLE Blog Maintenance MKDIR "%SystemDrive%\www\temp\blog" MOVE /Y "%SystemDrive%\www\blog\wp-content\uploads" "%SystemDrive%\www\temp\blog" COPY /Y "%SystemDrive%\www\blog\wp-config.php" "%SystemDrive%\www\temp\blog" CALL "%SystemDrive%\www\scripts\blog\Git Fix.bat" MOVE /Y "%SystemDrive%\www\temp\blog\uploads" "%SystemDrive%\www\blog\wp-content" MOVE /Y "%SystemDrive%\www\temp\blog\wp-config.php" "%SystemDrive%\www\blog\wp-config.php" RMDIR /S /Q "%SystemDrive%\www\temp\blog" :: End
"%SystemDrive%\www\scripts\blog\Maintenance.bat"
Git Fix
wp-config.php needs re-applied afterwards
Set email for
user.email
"notepad.exe" "%SystemDrive%\www\scripts\blog\Git Fix.bat"
@echo off RMDIR /S /Q "%SystemDrive%\www\blog\.git" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" init --initial-branch="master" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" add "." "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" config "user.email" "espionage724@x" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" commit --message="x" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" remote add "origin" "https://github.com/WordPress/WordPress.git" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" pull --depth "1" --recurse-submodules "origin" "master" --rebase "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\blog" reset --hard "origin/master" "%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
"%SystemDrive%\www\scripts\blog\Git Fix.bat"
Shortcuts
Autostart
PHP-CGI
"explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp"
"%SystemDrive%\www\scripts\blog\PHP-CGI.bat"
Blog PHP-CGI
Task Scheduler
taskschd.msc
Update
2:00:00 AMdaily
Blog Update
"%SystemDrive%\www\scripts\blog\Update.bat"
Back-up
- Weekly → Recur every
1weeks onMonday 12:15:00 AMTODO
Wiki File Back-up
"%SystemDrive%\www\scripts\media\Back-up.bat"
Maintenance
- Monthly → All months → Days:
3 2:30:00 AM
Blog Maintenance
"%SystemDrive%\www\scripts\blog\Maintenance.bat"
Initial Setup
Settings
wp-config.php
Change
DB_PASSWORD
"notepad.exe" "%SystemDrive%\www\blog\wp-config.php"
<?php
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wordpress' );
define( 'DB_PASSWORD', 'x' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8mb4' );
$table_prefix = 'wp_';
define( 'AUTOMATIC_UPDATER_DISABLED', true );
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
require_once ABSPATH . 'wp-settings.php';
// End
Files
Backup
"tar.exe" -czf "%UserProfile%\Downloads\wordpress-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "blog"
Database
Backup
CD "%USERPROFILE%\Downloads" && "%PROGRAMFILES%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" -p --opt -r "wordpress.sql" "wordpress"
Restore
"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE wordpress"
"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p "wordpress" < "%UserProfile%\Downloads\wordpress.sql"
/srv/www/wiki/data/attic/servers/windows/nginx/wordpress.1763537873.txt.gz · Last modified: by Sean Rhone
