nginx php 配置 windows_Windows 系统配置nginx + php

一、解压php安装包,配置php.ini文件

二、nginx的安装与配置

nginx.conf文件# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

#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;

#}

修改为# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

location ~ \.php$ {

root           D:/phpStudy/nginx/html;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

#fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

include        fastcgi_params;

}

root 网站的根目录,绝对地址,注意使用斜线/   不能使用反斜线

fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;

命令行输入

php-cgi.exe -b 127.0.0.1:9000

start nginx.exe

三、为了管理方便,编写启动 停止脚本

start.bat@echo off

REM Windows 下无效

REM set PHP_FCGI_CHILDREN=5

REM 每个进程处理的最大请求数,或设置为 Windows 环境变量

set PHP_FCGI_MAX_REQUESTS=1000

echo Starting PHP FastCGI...

REM RunHiddenConsole D:/phpdev/php/php-cgi.exe -b 127.0.0.1:9000 -c D:/phpdev/php/php.ini

RunHiddenConsole php-cgi.exe -b 127.0.0.1:9000

echo Starting nginx...

REM RunHiddenConsole D:/phpdev/nginx/nginx.exe -p D:/phpdev/nginx

RunHiddenConsole nginx.exe

stop.bat@echo off

echo Stopping nginx...

taskkill /F /IM nginx.exe > nul

echo Stopping PHP FastCGI...

taskkill /F /IM php-cgi.exe > nul

exit

restart_nginx.bat@echo off

REM 重启nginx

RunHiddenConsole nginx.exe -s reload

四、nginx 常用其它命令start nginx

tasklist /fi "imagename eq nginx.exe"

nginx -s stopfast shutdown

nginx -s quitgraceful shutdown

nginx -s reloadchanging configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes

nginx -s reopenre-opening log files

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值