zoukankan      html  css  js  c++  java
  • wnmp配置(windows+nginx+mysql+php开发环境)

    操作系统:win7 64位

    数据库:mysql (安装配置不在此详述)

    php5.5.30ns (安装配置不在此详述)

    问题的关键是:nginx 服务器与 php的关联

    一、服务器软件   nginx-1.11.4

      下载地址      http://nginx.org/en/download.html

        下载windows 版本nginx并解压,打开nginx.exe  cmd 中输入 start nginx。打开浏览器输入 localhost 看到如下界面即表示,nginx安装成功!

      (注意80端口占用问题,可在 conf文件夹下的nginx.conf文件中进行相关配置)
      
     
    二、PHP关联nginx服务器 (nginx 服务器 通过TCP端口 127.0.0.1:9000 建立与php-cgi.exe 进程的通信)
      根据nginx.conf中配置:
        #location ~ .php$ {
            #    root           www;
            #    fastcgi_pass   127.0.0.1:9000;
            #    fastcgi_index  index.php;
            #    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            #   include        fastcgi_params;
            #}
     
      配置PHP,开启数据库扩展
      extension=php_mysql.dll
      extension=php_mysqli.dll  
     
      令php以cgi的方式运行,在127.0.0.1:9000上。
      php-cgi.exe -b 127.0.0.1:9000 -c "php.ini"   
      
      
    三、在nginx配置文件中,配置pathinfo 访问模式,使得web服务器支持ThinkPHP
      location ~ ^.+.php {  
            root           html;  
            fastcgi_pass   127.0.0.1:9000;  
            fastcgi_index  index.php;  
            fastcgi_split_path_info ^(.+.php)(.*)$;  
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 这个要换成你自己的网站路径  
            fastcgi_param PATH_INFO $fastcgi_path_info;  
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;  
            include        fastcgi_params;  
        }  
      
    #原来的配置注释掉  
    #    location ~ .*.php?$ {  
    #        root           html;  
    #        fastcgi_pass   127.0.0.1:9000;  
    #        fastcgi_index  index.php;  
    #        fastcgi_param SCRIPT_FILENAME /script$fastcgi_script_name;  
    #        include        fastcgi_params;  
    #    } 
  • 相关阅读:
    [转]Invalid postback or callback argument
    DOS之用变量存储输出
    [转]Invalid character in a Base64 string
    [转]100 个强大的 CSS 制作菜单的教程
    [转]delphi的TList,TStringList,TObjectList
    面试感悟一名3年工作经验的程序员应该具备的技能
    Java编程思想重点笔记(Java开发必看)
    第一大章物理层思维导图
    第一大章1.1概论
    jmeter 正则表达式学习(二)使用实例 非墨
  • 原文地址:https://www.cnblogs.com/ahguSH/p/5925115.html
Copyright © 2011-2022 走看看