232121 发表于 2016-5-12 09:42:38

window 下安装nginx、php 、mysql过程及配置详解

下载

[*]mysql-5.7.12http://dev.mysql.com/downloads/mysql   

nginx-1.10.0http://nginx.org/en/download.html

php-5.6.21   http://php.net/downloads.php


安装

[*]mysql安装 我安装的v6.5 百度一下就知道


[*]nginx安装


[*]解压nginx到指定目录

[*]win+r打开运行输入cmd


[*]进入到nginx解压目录,使用start nginx.exe 安装nginx

   

[*]安装基本就是毫秒级的安装完成后,在浏览器输入127.0.0.1会出现nginx的欢迎界面



[*]nginx 的常用命令
   nginx.exe -s stop      //停止nginx
   nginx.exe -s reload   //重新加载nginx
   nginx.exe -s quit       //退出nginx


   3. php安装


[*]解压安装包到指定安装目录

[*]复制 D:\services-nmp\php\php-5.6.21 目录下的php.ini-development 并重命名为php.ini

[*]打开php.ini 修改配置

    extension_dir 修改为extension_dir = "D:/services-nmp/php/ext/" 注意斜杠 /   (php的安装路径)

      date.timezone 修改为date.timezone = Asta/BeiJing
      enable_dl (是否使dl()有效) 修改为enable_dl = On
      cgi.force_redirect = 1修改为cgi.force_redirect = 0

      fastcgi.impersonate修改为fastcgi.impersonate = 1

      cgi.rfc2616_headers修改为cgi.rfc2616_headers = 1
      打开mysql 扩展 : 去掉extension=php_mysql.dll   extension=php_mysqli.dll 前面的分号

配置 使用nginx访问php还需需要配置nginx


[*] 打开nginx的安装目录下的conf 下的nginx.cof


[*] 修改 location / {                                          
         root   html;
         indexindex.html index.htm;
      }
为location / {
            root   D:/services-nmp/nginx\nginx-1.10.0/html;   
            indexindex.html index.htmindex.php;
      }

    3. 修改

      # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
      #
      #location ~ \.php$ {
      #    root         html;
      #    fastcgi_pass   127.0.0.1:9000;
      #    fastcgi_indexindex.php;
      #    fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;
      #    include      fastcgi_params;
      #}
      为

      # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000   
      location ~ \.php$ {
            root               D:/services-nmp/nginx\nginx-1.10.0/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_indexindex.php;
            fastcgi_paramSCRIPT_FILENAME   $document_root$fastcgi_script_name;
            include      fastcgi_params;
      }
    4、保存配置,重启nginx

验证php是否安装成功
   1、执行cgi下载RunHiddenConsole 随便一搜就有 放到php的安装目录下然后cmd在php目录下执行如下命令
   
   2、重启nginx
   3、在nginx安装目录下的html文件夹下添加新的php程序 随便写个php程序就行
          <?php
                  phpinfo();
            ?>
   4、在浏览器中访问127.0.0.1/1.php 出现如下界面表示成功。



页: [1]
查看完整版本: window 下安装nginx、php 、mysql过程及配置详解