windows服务器nginx+php启动开源ecshop

1,下载php,nginx,ECShop源码

2,解压php到指定目录(如:C:\php-7.2.6)

 2.1,找到指定目录下文件php.ini-development复制重命名为php.ini

 2.2,编辑php.ini内容找到;extension_dir="ext"去掉前面的分号(就是取消注释)

 2.3找到;cgi.fix_pathinfo去掉分号取消注释(网上看到打开此项会有漏洞,后续具体看)

 2.4修改nginx.conf添加一个监听如下

server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        # 打开log
        access_log  logs/host.access.log;

        location / {
            # 设置网站的根目录(类似Apache的www目录)
            # 这个路径自己定义就行,下面的是我自己的路径
            root   c:/ecshop;
            # 把index.php添加到默认首页,就是输入/时自动打开/index.php
            index  index.html index.htm index.php;
        }

        # 打开404页面(可以不动)
        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        # 配置FastCGI,PHP 脚本请求全部转发到 FastCGI处理
        location ~ \.php$ {
            # 
            root           c:/ecshop;
            # 设置监听端口
            fastcgi_pass   127.0.0.1:9000;
            # 设置nginx的默认首页文件(上面已经设置过了,可以删除)
            fastcgi_index  index.php;
            # 设置脚本文件请求的路径
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            # 引入fastcgi的配置文件
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
            deny  all;
        }
    }

3,启动nginx

4启动cgi(C:/php-7.2.6/php-cgi.exe -b 127.0.0.1:9000 -c C:/php-7.2.6/php.ini)可能遇到没错runtime140需先装c++2015