windows下ngnix+php配置

1、需要工具:

成都创新互联是一家集网站建设,琼山企业网站建设,琼山品牌网站建设,网站定制,琼山网站建设报价,网络营销,网络优化,琼山网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

下载:RunHiddenConsole

2、将下载文件解压后,将RunHiddenConsole拷贝到ngnix目录与php所在目录

修改conf目录下ngnix.conf,使其支持php

server { listen 80; #端口 server_name example.org www.example.org; #域名 root e:/www; location / { index index.html index.php; } location ~* .(gif|jpg|png)$ { expires 30d; #缓存图片文件 } #支持php location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME e:/www$fastcgi_script_name; include fastcgi_params; } }

另外可以把虚拟主机单独出来。在ngnix.conf文件中加入如下代码

http{ #其它代码 include vhost/*.conf; #加载vhost目录下的虚拟主机配置文件 } 可以在conf文件夹中新建一个vhost文件夹,在此目录下建立新文件自定义文件名,扩展名为conf即可,在文件中加入如下代码 server { listen 80; server_name www.szs.com; #charset koi8-r; #access_log logs/host.access.log main; location / { root E:/20nc; index index.php index.html index.htm; } #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; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { #root D:/wamp/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME E:/20nc$fastcgi_script_name; include fastcgi_params; } location ~* .(gif|jpg|png)$ { expires 30d; } # deny access to .htaccess files, if Apache\'s document root # concurs with nginx\'s one # location ~ /.ht { deny all; } }

3、配置php.ini文件使其支持cgi

;cgi.force_redirect = 1,删除前面的分号:cgi.force_redirect = 1

;cgi.fix_pathinfo=1,删除前面的分号:cgi.fix_pathinfo=1

;cgi.rfc2616_headers = 0,删除前面的分号:cgi.rfc2616_headers = 1

4、制作启动和关闭ngnix文件

注意:路径请自行更改 start.bat @echo off echo start_nginx.bat   echo Starting PHP FastCGI... cd D:/bin/php/php5.5.12 d:   RunHiddenConsole php-cgi.exe -b 127.0.0.1:9000 -c php.ini   echo Starting nginx... cd C:/nginx c:   RunHiddenConsole nginx.exe   Exit exit.bat @echo off   echo stop_nginx.bat   echo Stopping nginx...   taskkill /F /IM nginx.exe > nul   echo Stopping PHP FastCGI...   taskkill /F /IM php-cgi.exe > nul   exit


名称栏目:windows下ngnix+php配置
文章起源:http://bzwzjz.com/article/cjiegj.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站建设公司 成都网站建设 手机网站制作 重庆网站制作 企业网站制作 成都网站制作 专业网站设计 手机网站建设 网站建设公司 定制级高端网站建设 LED网站设计方案 成都模版网站建设 成都响应式网站建设公司 成都网站制作 成都品牌网站建设 成都网站建设 成都网站设计 做网站设计 梓潼网站设计 网站建设推广 成都网站设计公司 成都做网站建设公司