win下nginx+php7+mysql配置
nginx+mysql部署请查看 洗盡鉛華,最終是你
php7部署
下载安装包: http://yuefly.com/upload/software/php-7.2.33-nts-Win32-VC15-x64.zip
解压安装包并重命名php7
php7安装与配置
1、将php7目录下的php.ini-development文件复制一份并改名为php.ini
2、用文本编辑器将它打开php.ini
3、将;extension_dir = "ext"改为extension_dir = “C:/software/php7/ext”。(以自己的实际目录为准)
5、将;cgi.fix_pathinfo=1去掉前面“;”:cgi.fix_pathinfo=1(使nginx能够支持php)
6、将;date.timezone = 改为;date.timezone = Asia/Shanghai(时间配置)
7、如图,把扩展都装上,去掉前面分号即为装上。
php 启动
cd C:\software\php7
php-cgi.exe -b 127.0.0.1:9000
nginx配置
打开编辑nginx-1.16.1/conf/nginx.conf,添加
include C:/software/nginx-1.16.1/conf/vhost/*.conf;
在vhost目录下新建配置文件xxx.conf
server
{
listen 80;
server_name xxx.com;
index index.php index.html index.htm default.php default.htm default.html;
root C:/wwwroot/xxx.com;
location / {
index index.php index.html;
error_page 403 /error/403.html;
autoindex off;
# 主要是这个是新加的起作用的,
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
location ~ \.php$ {
root C:/wwwroot/xxx.com;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}