zoukankan      html  css  js  c++  java
  • nginx windows下安装成功。。

       第一步 下载nginx ,windows版本,解压保存在C:/nginx下( 用的1.0.3版)

       第二步 下载 php fast-cgi版本(我用的是 VC9 x86 Non Thread Safe),解压到C:/php下

       第三步 把C:/php/php.ini-development重命名成C:/php/php.ini,找到#cgi.fix_pathinfo=1,把#号去掉

      第四步  修改C:/nginx/conf/nginx.conf

      下面是我的简单配置:

     
    #user  nobody;
    worker_processes  1;

    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;

    #pid        logs/nginx.pid;


    events {
        worker_connections  1024;
    }


    http {
        include       mime.types;
        default_type  application/octet-stream;

        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';

        #access_log  logs/access.log  main;

        sendfile        on;
        #tcp_nopush     on;

        #keepalive_timeout  0;
        keepalive_timeout  65;

        #gzip  on;

        server {
            listen       80;
            server_name  localhost;

            #charset koi8-r;

            #access_log  logs/host.access.log  main;

            location / {
                #root   html;           //此处为默认路径
                root   D:/public_html;   //此处为我修改,要运行PHP程序的路径
                index  index.php index.html index.htm;  //增加了 index.php
            }

            #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$ {
             #   root         php;
                #index        index.php
                #proxy_pass   http://127.0.0.1;
            #}

            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            location ~ \.php$ {
                root           D:/public_html;        //运行的PHP程序路径
                fastcgi_pass   127.0.0.1:9000; 
                fastcgi_index  index.php;          //默认首页程序
                fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;  //$document_root 指的是上面的 D:/public_html
                include        fastcgi_params;
             
            }

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


        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;

        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}


        # HTTPS server
        #
        #server {
        #    listen       443;
        #    server_name  localhost;

        #    ssl                  on;
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;

        #    ssl_session_timeout  5m;

        #    ssl_protocols  SSLv2 SSLv3 TLSv1;
        #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
        #    ssl_prefer_server_ciphers   on;

        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}

    }

       第五步 ,PHP以fast-cgi形式运行

    在CMD下运行下面(路径可能有些不同)

     第六步  点击运行 nginx.exe  ,运行nginx

     第七步  浏览器中输入 localhost/index.php,就运行D:/public_html/index.php这个程序了

  • 相关阅读:
    N*N内递矩阵算法
    四舍五入算法C语言
    springboot整合hivejdbc遇到的坑
    Gradle 中 exclude group 关键字运用
    sparklocal运行异常Could not locate executable null\bin\winutils.exe in the Hadoop binaries
    大数据的五大关键技术
    opencv+python+pycharm实现人脸识别
    Python开源人脸识别库,识别率达99.38%!内附教程+源码分享
    Python实时语音识别控制
    JAVA操作鼠标和键盘
  • 原文地址:https://www.cnblogs.com/flex_fly/p/2060161.html
Copyright © 2011-2022 走看看