zoukankan      html  css  js  c++  java
  • windows 下安装 nginx + php

    1. 下载软件

      需要的软件有nginx,php,mysql(如不需要可不安装)
      nginx.org,www.php.net上面有得下
      全部解压出来
      php基本不用做任何修改(下载直接解压版本的)

      用cmd命令在nginx 目录执行 start nginx.exe 就可以启动 nginx ,注意80端口是否被占用,启动成功 在浏览器运行 localhost 就可以打开nginx 默认页面

      

    但是,现在还不能运行php文件,需要进行配置,继续

    2. 配置 nginx

      在nginx.conf 文件找到以下被注释的代码,修改root为绝对路径,并设置SCRIPT_FILENAME 后面的用$document_root 替代

      # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ .php$ {
        root E:/PHPTools/nginx-1.13.4/html;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
        include fastcgi_params;
      }

    3. 运行软件

      cmd 命令在php安装目录执行 start php-cgi.exe -b 127.0.0.1:9000 -c php.ini

      cmd 命令在nginx 安装目录执行nginx.exe -s stop 先把刚才启动的nginx进程关掉,然后重新启动 start nginx.exe

      到此,nginx + php 配置完成。再安装mysql就可以进行开发了。

    参考文献:http://www.nginx.cn/doc/setup/nginx-windows.html

  • 相关阅读:
    02梦断代码阅读笔记之二
    每日日报
    每日日报
    每日日报
    每日日报
    02梦断代码阅读笔记之一
    每日日报
    SQL语句分为哪几种?
    数据库三范式是什么?
    什么是数据库事务?
  • 原文地址:https://www.cnblogs.com/songlen/p/7424319.html
Copyright © 2011-2022 走看看