華文網

WNMP一鍵部署方案

前言

本文簡要介紹了windows+nginx1.12+mysql5.6+php7整套環境的搭建部署,此方案安裝簡介,

十分易用,並且便於維護,非常適用於手頭目前沒有linux環境想跑php項目或測試開發環境的同學們。

檔目錄結構

目錄結構

start_nginx.bat為開啟nginx的腳本;

start_php_fpm.bat為開啟php-fpm的腳本;

start_mysql.bat為開啟mysql服務的腳本;

start.bat為開啟上述所有進程的腳本;

stop.bat為關閉所有進程的腳本。

文件地址:

http://www.jishux.com/plus/view-625391-1.html

簡單使用手冊***********Author Salamander**************1. 把nginx,
mysql,php壓縮包解壓,並命名為nginx,mysql,php7(標識一下新版本而已),以下設定檔用utf-8修改(sublime即可)2. php目錄中把php.ini-development(或者php.ini-production)改為php.ini,修改extension_dir配置,注意去掉分號(;)分號表示注釋,另外把一些擴展也載入進來(去掉前面分號即可)**********************************************extension=php_bz2.dllextension=php_curl.dllextension=php_fileinfo.dllextension=php_ftp.dllextension=php_gd2.dllextension=php_gettext.dll; Directory in which the loadable extensions (modules) reside.; http://php.net/extension-dir; extension_dir = "./"; On windows:extension_dir = "D:/nmp/php7/ext"**********************************************啟動php-cgi可以按兩下start_php_fpm.bat即可3.進入nginx中conf目錄,打開nginx.conf檔找到server段(配置localhost虛擬主機)************************************************************* server { listen 80; server_name localhost; root D:/web_root; index index.php index.html index.htm; #charset koi8-r; #access_log logs/host.access.log main; #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }*************************************************************這個server的根目錄為D盤下web_root,index第一個為index.php你需要D盤新建web_root資料夾,再在web_root中新建文件index.php,寫入
內容為*****************************************************************[client]port=3306default-character-set=utf8[mysqld]port=3306innodb_buffer_pool_size = 512Mcharacter_set_server=utf8server_id=784basedir=D:/nmp/mysql#解壓目錄datadir=D:/nmp/mysql/data#解壓目錄下data目錄max_allowed_packet = 10Mtable_open_cache = 256sort_buffer_size = 1Mread_buffer_size = 1Mread_rnd_buffer_size = 4Mmyisam_sort_buffer_size = 64Mthread_cache_size = 8log-bin=mysql-binsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES*****************************************************************啟動mysql可以按兩下start_mysql.bat即可5. 關閉所有進程,按兩下stop.bat即可,啟動所有進程,按兩下start.bat