码迷,mamicode.com
首页 > Windows程序 > 详细

win php nginx 配置小细节

时间:2016-12-17 16:26:32      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:pathinfo   oca   php nginx   nginx   art   ima   md5   ica   fastcgi   

win下配置php Nginx


首先 下载 php-Windows版本、下载Nginx Windows 版本

1> php.ini-production 修改为 php.ini 让其成为php的配置文件

修改 php.ini 771行 cgi.fix_pathinfo=1 打开

2>修改 nginx/conf/nginx.conf

这个配置文件是分层的 如 http server 等

我们要修改的是 server 层 ,层级之间有一个继承关系, 内层继承外层, 同级层配置互不干扰,也就是说

http 层下面可能有 很多个 server 层


http{

#普通http配置
server{
location / {
root E:/nginx-1.11.7/html; #这里是站点的根目录
index index.php index.html index.htm; #入口
}

location ~ \.php$ {
root E:/nginx-1.11.7/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}


}

修改完配置之后

启动Nginx:start nginx
快速停止或关闭Nginx:nginx -s stop
正常停止或关闭Nginx:nginx -s quit
配置文件修改重装载命令:nginx -s reload


tasklist /fi "imagename eq nginx.exe" 查看nginx是否启动成功

 

启动php-cgi

start e:/php-5.6.29/php-cgi.exe -b 127.0.0.1:9000 -c e:/php-5.6.29/php.ini


就可以测试 Nginx环境是否可以解析php程序了 ok没问题就配置成功了

win php nginx 配置小细节

标签:pathinfo   oca   php nginx   nginx   art   ima   md5   ica   fastcgi   

原文地址:http://www.cnblogs.com/dwight/p/winphpnginx.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!