windows下PHP和nginx的简单配置
2015-05-05 16:42
337 查看
用markdown写出来的博客真是很清晰、漂亮
去掉以下关键字前面的分号
开启php-cgi和nginx.exe,保存为startPhpAndNginx.bat
停止php-cgi和nginx.exe,保存为stopPhpAndNginx.bat
1. 下载PHP和nginx
2. php配置
修改php.ini-development文件,将文件名修改为php.ini去掉以下关键字前面的分号
关键字 | 说明 |
---|---|
error_reporting = E_ALL。 | 设置错误报告的级别 |
display_errors = On。 | 是否将错误信息显示到控制台 |
default_charset = “UTF-8”。 | 默认字符集UTF-8 |
extension_dir = “./ext”。 | 可加载库的文件夹路径 |
如:extension=php_curl.dll。 | 选择要加载的动态库 |
cgi.force_redirect = 1。 | 使用PHP作为CGI |
cgi.rfc2616_headers = 1。 | PHP会发送HTML1.1标准协议头部 |
cgi.fix_pathinfo = 1。 | PHP会自动检测PATH_INFO |
3. nginx配置
nginx HttpFastcgiModule[code]#虚拟主机的配置 server { listen 80; #域名可以有多个,用空格隔开 server_name localhost 127.0.0.1; #定义服务器的默认网站根目录位置 root D:\myphp; #定义首页索引文件的名称 index index.html index.htm index.php; #默认请求,如请求静态文件 location / { } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 #对请求PHP动态页面请求的处理 location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #调用fastcgi.conf配置文件来传递服务器变量,这样CGI中可以获取到这些变量的值。 include fastcgi.conf; } }
4. 测试运行系统
在D:myphp中新建index.php文件:[code]<?php phpinfo(); ?>
开启php-cgi和nginx.exe,保存为startPhpAndNginx.bat
[code]@echo off echo Starting PHP FastCGI start c:/php/php-cgi.exe -b 127.0.0.1:9000 -c c:/php/php.ini echo Starting nginx start C:/nginx/nginx.exe -p C:/nginx echo Success PAUSE exit
停止php-cgi和nginx.exe,保存为stopPhpAndNginx.bat
[code]@echo off echo Stopping nginx... C:/nginx/nginx.exe -p C:/nginx -s stop echo Stopping PHP FastCGI... taskkill /F /IM php-cgi.exe > nul PAUSE exit
5. 访问127.0.0.1
相关文章推荐
- 搭建windows+Nginx+PHP配置指南 以及 之后的问题解决
- windows环境配置 nginx + php + mysql
- windows+apache+mysql+php 简单配置步骤
- wnmp环境配置(windows+nginx+mysql+php)
- windows上 nginx 配置代理服务,配置多域名,以及最简单实现跨域配置
- windows下nginx支持php的配置
- nginx+php 在windows下的简单配置安装
- Windows 下 Nginx + PHP + MySQL 开发环境安装与配置
- Windows下配置Nginx+php+mysql
- windows 下nginx php mysql memcache 的安装与配置(转)
- windows下WNMP(windows+nginx+mysql+php)配置
- windows下配置nginx+php+mysql
- Windows 下 Nginx + PHP + Xdebug + PHPStorm 调试环境配置
- Nginx+Mysql+PHP安装和配置,简单优化
- Windows下的Nginx安装与配置(PHP)
- windows下php7.0.13 和nginx1.10.2安装配置
- Windows下配置Nginx使之支持PHP(转)
- php+nginx+mysql环境配置windows
- Windows下Nginx+PHP CGI+QeePHP好看又好用的rewrite配置
- windows 下PHP 和 nginx配置