WNMP 环境搭建

系统Windows10

Nginx 下载地址 http://nginx.org/en/download.html

php 下载地址 https://windows.php.net/download

mariadb 下载地址 https://downloads.mariadb.org/mariadb/

RunHiddenConsole 下载地址 https://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip

添加环境变量 位置 - 高级系统设置

 Mysql

使用 Windows PowerShell(管理员) 进行安装
mysql_install_db --datadir=D:/WNMP/mariadb-10.5.10/data --service=MariaDB --password=123456

更改配置 位置 C:WNMPmariadb-10.5.3-winx64datamy.ini
[mysqld]
datadir=D:/WNMP/mariadb-10.5.10/data
collation-server=utf8mb4_general_ci
init-connect='SET NAMES utf8mb4'
character-set-server=utf8mb4
[client]
plugin-dir=D:/WNMP/mariadb-10.5.10/lib/plugin
default-character-set=utf8mb4

启动  start C:WNMPmariadb-10.5.10-winx64inmysqld.exe

php 配置

#将C:WNMPphp-7.4.19php.ini-production 复制一份改名为php.ini修改以下配置项
date.timezone = Asia/Shanghai
expose_php = off
max_execution_time = 0
memory_limit = 4096M
display_errors = On
cgi.fix_pathinfo=0
extension_dir = "C:WNMPphp-7.4.19ext"

#扩展
extension=mbstring
extension=mysqli
extension=bz2
extension=curl
extension=gd2
extension=pdo_mysql
extension=openssl
extension=pgsql

php 启动 RunHiddenConsole C:WNMPphp-7.4.19php-cgi.exe -b 127.0.0.1:9000 -c C:WNMPphp-7.4.19php.ini

nginx 配置 - 参考

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location ~ .php$ {
            root    html;
            index index.php index.html index.htm;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass 127.0.0.1:9000;
            try_files $uri =404;
        }

    }

启动Nginx  RunHiddenConsole C:/WNMP/nginx-1.20.0/nginx.exe -p C:/WNMP/nginx-1.20.0

一切正常 

-------------------------------------------------------  分割线  ------------------------------------------------------------

创建 start.bat 启动文件 

@echo off
echo Starting mysql...
start C:WNMPmariadb-10.5.10-winx64inmysqld.exe

REM Windows 下无效
REM set PHP_FCGI_CHILDREN=5
REM 每个进程处理的最大请求数,或设置为 Windows 环境变量
set PHP_FCGI_MAX_REQUESTS = 1000
echo Starting PHP FastCGI...
RunHiddenConsole C:WNMPphp-7.4.19php-cgi.exe -b 127.0.0.1:9000 -c C:WNMPphp-7.4.19php.ini

echo Starting nginx...
RunHiddenConsole C:/WNMP/nginx-1.20.0/nginx.exe -p C:/WNMP/nginx-1.20.0

pause

 关闭文件 stop.bat

@echo off
echo Stopping mysqld...
taskkill /F /IM mysqld.exe
echo Stopping nginx...  
taskkill /F /IM nginx.exe
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe
exit

参考文章:

https://blog.csdn.net/xjcallen/article/details/106157011

https://www.cnblogs.com/huangguojin/p/5900988.html

原文地址:https://www.cnblogs.com/blue-t/p/14787942.html