win7+nginx+php搭建
先在E盘创建一个名叫“wnmp”的文件夹,然后把PHP解压到改文件下。
下载nginx,地址:http://nginx.org/en/download.html如图
?
?
在wnmp文件夹中创建名为“nginx”文件夹,把nginx解压到改文件夹下。配置?进入php文件夹,将“php.ini-development”修改为php.ini打开php.ini文件,对一下内容进行修改extension_dir = "ext"date.timezone = Asia/ChongQing?
因为nginx需要cgi方式的php,所以还需要更改一下几处内容
enable_dl = Oncgi.force_redirect = 0cgi.fix_pathinfo=1fastcgi.impersonate = 1cgi.rfc2616_headers = 1
?到这里PHP配置告一段落,接着配置nginx。
?
先启动nginx,用DOS进入nginx路径,用一下命令启动nginxnginx -s reload //重启Nginxnginx -s stop //暂停nginx -s quit //退出nginxstart nginx //启动?然后在浏览器的地址栏中输入127.0.0.1出现一下界面,说明nginx启动正常
events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; #本地IP root E:/wnmp/www; #存放网站的根目录 location / { index index.php index.html index.htm; #添加index.php。 #autoindex on;#如果文件不存在列出目录结构; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; #fastcgi及监听的端口与php的cgi启动时要一致 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }}?
?