前言
本文简要介绍了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.dll extension=php_curl.dll extension=php_fileinfo.dll extension=php_ftp.dll extension=php_gd2.dll extension=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,写入 <?php echo "hello salamander"; // 为了测试下nginx和php 启动nginx可以双击start_nginx.bat即可 4.mysql目录中放入my.ini文件,内容为 ***************************************************************** [client] port=3306 default-character-set=utf8 [mysqld] port=3306 innodb_buffer_pool_size = 512M character_set_server=utf8 server_id=784 basedir=D:/nmp/mysql #解压目录 datadir=D:/nmp/mysql/data #解压目录下data目录 max_allowed_packet = 10M table_open_cache = 256 sort_buffer_size = 1M read_buffer_size = 1M read_rnd_buffer_size = 4M myisam_sort_buffer_size = 64M thread_cache_size = 8 log-bin=mysql-bin sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES ***************************************************************** 启动mysql可以双击start_mysql.bat即可 5. 关闭所有进程,双击stop.bat即可,启动所有进程,双击start.bat
本文暂时没有评论,来添加一个吧(●'◡'●)