cygwin nginx php mysql_Window搭建 Nginx PHP 开发环境

NGINX 可以通过 FastCGI 守护进程与 Windows 上的PHP进行连接

你可以使用 php-cgi.exe -b 127.0.0.1: 启用 FastCGI

启动后,php-cgi.exe 将继续在命令提示符窗口中监听连接。

如果你要隐藏该窗口,请使用小型实用程序: RunHiddenConsole

安装Nginx

2. 解压下载的压缩包

fe5a2fcf7c37c8ea070256b890c5950a.png

这样就可以使用 CMD 进入 D:\nginx-1.10.3> 执行启动, 关闭, 重启 等操作,可以进行以下操作nginx -s stop快速关闭Nginx

nginx -s quit优雅的关闭Nginx

nginx -s reload 更改配置,使用新配置启动新工作进程,正常关闭旧工作进程

nginx -s reopen 重新打开日志文件

安装PHP

2. 解压下载的压缩包

63b313cb41158ee6c921351813e9f847.png

这样就可以使用 CMD 进入 D:\php-5.6.34-Win32-VC11-x64> 开启 FastCGID:\php-5.6.34-Win32-VC11-x64>php-cgi.exe -b 127.0.0.1:9000

配置nginx.conf

nginx.conf (该文件在nginx安装目录的conf里面,如我的是: D:\nginx-1.10.3\conf)server {

listen       80;

server_name  localhost;

root   html;

index  index.php;

if (!-e $request_filename) {

rewrite ^(.+)$ /index.php$1 last;

}

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

}

location ~* .*\.php($|/)

{

if ($request_filename ~* (.*)\.php) {

set $php_url $1;

}

if (!-e $php_url.php) {

return 403;

}

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi.conf;

}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

#    deny  all;

#}

}

注意:Windows 版本的 nginx 使用原生 Win32 API 实现(而不是使用 Cygwin 模拟)。现在只使用了 select() 连接处理方法,所以不要期望高性能和可扩展性,加上还有很多其他的问题,现在Windows 版本的nginx也就是一个 BETA 版本。以下是官方描述Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected. Due to this and some other known issues version of nginx for Windows is considered to be a beta version.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值