User Tools

Site Tools


servers:windows:nginx:wordpress

This is an old revision of the document!


Information

Prerequisites

Dependencies

Git

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

MariaDB Server

  • No Development components or Third party tools
  • Use UTF8 as default server's character set
  • [x] Enable Networking

Download Source

git clone --branch "master" --depth "1" --recurse-submodules "https://github.com/WordPress/WordPress.git" "%SystemDrive%\www\blog"
explorer "%SystemDrive%\www\blog"

Database

"%ProgramFiles%\MariaDB 11.6\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 "%SystemDrive%\www\php\blog.ini"
[PHP]
; Modules
extension_dir = ".\ext"
extension = "curl"
extension = "exif"
extension = "fileinfo"
extension = "gd"
extension = "intl"
extension = "mbstring"
extension = "mysqli"
extension = "openssl"
extension = "sodium"
zend_extension = "opcache"

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

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

freenginx + PHP-CGI Configuration

PHP-CGI

  • :!: fastcgi_params include hard-coded to freenginx version path
notepad "%SystemDrive%\www\nginx\default.d\blog.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:9004";
}

Server Block

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

    client_max_body_size "10M";

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

#    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;

    location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
          access_log off; log_not_found off; expires max;
    }
}
"%SystemDrive%\www\scripts\freenginx\Reload.bat"

Batch Files

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

PHP-CGI

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

Autostart

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

Update

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

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

pause

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

Maintenance

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

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

pause

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

Initial Setup

Settings

wp-config.php

  • Add around line 90 2)
notepad "%SystemDrive%\www\blog\wp-config.php"
define( 'WP_AUTO_UPDATE_CORE', false );
2)
convenient Add any custom values between this line and the “stop editing” line.
/srv/www/wiki/data/attic/servers/windows/nginx/wordpress.1736645080.txt.gz · Last modified: by Sean Rhone