折腾了好久,以前是java,现在要转php 本地还是用win系统吧 ,nginx安装是比较简单的,但是我本地只能用nginx.exe启动,命令不行。。。先这样吧
wnmp(windows+nginx+mysql+php)
1.下载相关软件
Nginx
MySql 5.7
PHP
2.安装nginx
将此两个文件解压缩到同一文件夹下
最好将版本号去掉 , 为了目录简洁。
打开nginx下的nginx.exe 访问: http://localhost 显示以下页面 表示安装成功。
3.配置php环境
修改 php.ini(将php下文件夹php.ini.development改名文php.ini)
extension_dir = "C:\myfile\toolsApp\wnmp\php\ext"
extension=php_mysqli.dll
enable_dl = On
cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1
cgi.rfc2616_headers = 1
extension=php_mysqli.dll
enable_dl = On
cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1
cgi.rfc2616_headers = 1
4.nignx支持php
location / {
root C:\myfile\toolsApp\wnmp\nginx\html;
index index.html index.htm index.php;
}
root C:\myfile\toolsApp\wnmp\nginx\html;
index index.html index.htm index.php;
}
location ~ \.php$ {
root C:\myfile\toolsApp\wnmp\nginx\html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
root C:\myfile\toolsApp\wnmp\nginx\html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
5.测试
C:\myfile\toolsApp\wnmp\nginx\html 下新建 phpinfo.php
<?php
phpinfo();
?>
phpinfo();
?>
在cmd 中输入以下
C:/myfile/toolsApp/wnmp/php/php-cgi.exe -b
127.0.0.1:9000
-c C:/myfile/toolsApp/wnmp/php/php.ini
重启nginx
http://localhost:8080/phpinfo.php
OK