1. 程式人生 > >wnmp windows 2012 r2+php7.0+nginx1.14安裝

wnmp windows 2012 r2+php7.0+nginx1.14安裝

pts oot 界面 host ati stc 去掉 編輯 gin

1安裝包
Nginx 下載 http://nginx.org/en/download.html
PHP http://php.net/downloads.php 選擇對應操作系統非線程安全(NTS)
mysql安裝msi安裝
https://dev.mysql.com/downloads/file/?id=471661
mysql壓縮包 https://dev.mysql.com/downloads/mysql/5.7.html#downloads
2安裝
解壓後可以把PHP和Nginx文件放在一個文件夾下面 比如 c:\www
2.1nginx 運行
運行Nginx目錄下面的 nginx.exe 打開localhost
看到Nginx歡迎界面表示安裝成功
3環境配置
3.1Nginx配置支持PHPfastcgi
用編輯器打開Nginx目錄下面的 nginx.conf
找到
location / {,
root html;
index index.html index.htm;
}
改為
location / {,
root c:\www;
index.php index index.html index.htm;
}
找到
#location ~ .php$ {
#root html;
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#include fastcgi_params;
#}
去掉前面的#註釋 改為
location ~ .php$ {
root c:\www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
3.2PHP配置
打開PHP目錄
php.ini-development復制一份改名為php.ini
將;extension_dir = "ext"改為extension_dir = “c:\www\ext”。(以自己的實際目錄為準)
將;cgi.fix_pathinfo=1去掉前面“;”:cgi.fix_pathinfo=1(使nginx能夠支持php)
將;date.timezone = 改為;date.timezone = Asia/ChongQing(時間配置)
4測試
在c:\www下面新建 index.php
寫入<?php phpinfo();
4.1打開nginx
運行nginx 下面的nginx.exe (如果之前已經啟動 先關閉後臺進程中的 nginx.exe)
4.2打開PHP
cd 到PHP目錄下
php-cgi.exe -b 127.0.0.1:9000 -c php.ini
在瀏覽器輸入localhost 顯示PHP信息表示成功

技術分享圖片

wnmp windows 2012 r2+php7.0+nginx1.14安裝