zoukankan      html  css  js  c++  java
  • windows下nginx的配置

    1.首先找到php安装目录下的php-cgi.exe 运行起来

    php-cgi.exe -b 127.0.0.1:9999 -c xxx:/php.ini

    2.下载windows版本的nginx,下载后,解压到指定的目录后,进行到conf下面

    编辑nginx.conf,在http{}这个区间的最后(个人喜欢)加入以下代码

    autoindex on;  # 开启目录浏览
    autoindex_exact_size off;
    #默认为on,显示出文件的确切大小,单位是bytes。
    #改为off后,显示出文件的大概大小,单位是kB或者MB或者GB
    autoindex_localtime on;
    #默认为off,显示的文件时间为GMT时间。
    #改为on后,显示的文件时间为文件的服务器时间


    include D:/wamp/nginx-1.0.4/conf/vhosts/tpshop.conf; #引入多个站点配置
    include D:/wamp/nginx-1.0.4/conf/vhosts/pmd.conf;

    3.配置多站点 创建这两个文件

    tpshop.conf:

    location ~ .php{
    root D:/work/tpshop;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
    }

    pmd.conf:

    location ~ .php{
    root D:/work/pmd;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
    }

    4.最后nginx.conf同级下创建 fcgi.conf 些文件是让nginx有pathinfo功能

    set $path_info "";
    set $real_script_name $fastcgi_script_name;
    if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
    set $real_script_name $1;
    set $path_info $2;
    }
    fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
    fastcgi_param SCRIPT_NAME $real_script_name;
    fastcgi_param PATH_INFO $path_info;
    #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;

    #fastcgi_param SCRIPT_NAME $fastcgi_script_name;

    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_PROTOCOL $server_protocol;

    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;

    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    #fastcgi_param REDIRECT_STATUS 200;

  • 相关阅读:
    图片api
    基于NoneBot的天气查询插件
    在Linux云服务上运行酷Q机器人并DIY自己的功能
    破解zip密码的几种方法
    攻防世界wp--crypto 幂数加密
    攻防世界wp--crypto Caesar
    攻防世界wp--web command_execution
    攻防世界wp--web weak_auth
    python中yield的用法以及和yield from的区别
    Linux进阶之正则,shell三剑客(grep,awk,sed),cut,sort,uniq
  • 原文地址:https://www.cnblogs.com/ahwu/p/3275211.html
Copyright © 2011-2022 走看看