2021年8月

更详细内容可参考网址:
https://www.cnblogs.com/byron0918/p/9542264.html
https://www.cnblogs.com/freeweb/p/5446632.html

官网下载nginx免安装包,解压到D盘

目录结构:

D:.
│  nginx.exe
│
├─conf
│      fastcgi.conf
│      fastcgi_params
│      koi-utf
│      koi-win
│      mime.types
│      nginx.conf
│      scgi_params
│      uwsgi_params
│      win-utf
│
├─contrib
│  │  geo2nginx.pl
│  │  README
│  │
│  ├─unicode2nginx
│  │      koi-utf
│  │      unicode-to-nginx.pl
│  │      win-utf
│  │
│  └─vim
│      ├─ftdetect
│      │      nginx.vim
│      │
│      ├─ftplugin
│      │      nginx.vim
│      │
│      ├─indent
│      │      nginx.vim
│      │
│      └─syntax
│              nginx.vim
│
├─docs
│      CHANGES
│      CHANGES.ru
│      LICENSE
│      OpenSSL.LICENSE
│      PCRE.LICENCE
│      README
│      zlib.LICENSE
│
├─html
│      50x.html
│      index.html
│
├─logs
│      access.log
│      error.log
│      nginx.pid
│
└─temp
    ├─client_body_temp
    ├─fastcgi_temp
    ├─proxy_temp
    ├─scgi_temp
    └─uwsgi_temp

修改配置文件D:\nginx-1.18.0\conf\nginx.conf

  • 相关配置:
        #将"/"目录、"/file"都映射到D盘file目录下,并打开目录访问功能。
        location / {
            root   D:/file/;
            rewrite ^/file/(.*)$ /$1 break;
            autoindex on;
        }
  • 运行命令:
重启nginx进程:nginx -s reopen
关闭nginx进程:nginx -s stop
优雅地停止Nginx服务(即处理完所有请求后再停止服务):nginx -s quit
重新加载配置文件:nginx -s reload
检测配置文件是否有语法错误:nginx -t
  • 完整文件:

#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;

        #将"/"目录、"/file"都映射到D盘file目录下,并打开目录访问功能。
        location / {
            root   D:/file/;
            rewrite ^/file/(.*)$ /$1 break;
            autoindex on;
        }

        #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
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    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 ssl;
    #    server_name  localhost;

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

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

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

}

附录:

  • loaction语法符号
= 开头表示精确匹配
^~ 开头表示uri以某个常规字符串开头,不是正则匹配
~ 开头表示区分大小写的正则匹配
~* 开头表示不区分大小写的正则匹配
/ 通用匹配, 如果没有其它匹配,任何请求都会匹配到
  • 正则表达符号
. : 匹配除换行符以外的任意字符
? : 重复0次或1次
+ : 重复1次或更多次
* : 重复0次或更多次
\d :匹配数字
^ : 匹配字符串的开始
$ : 匹配字符串的结束
{n} : 重复n次
{n,} : 重复n次或更多次
[c] : 匹配单个字符c
[a-z] : 匹配a-z小写字母的任意一个

注:
小括号()之间匹配的内容,可以在后面通过$1来引用,$2表示的是前面第二个()里的内容。
正则里面容易让人困惑的是\转义特殊字符。

  • 如果这个问题涉及的对象有官网,首先在查看官网的使用说明。
  • 如果官网没找到解决办法,那么百度关键字查询办法。
  • 如果百度也不行,那么谷歌。
  • 如果谷歌也不行,那么问同事。

问题描述:nginx修改配置文件后,无论怎么重启,都不生效。
原因可能是:之前安装过nginx。
解决办法:从任务管理器关闭两个nginx.exe的进程,然后删除以前的nginx文件夹。

修改模板:

public java.lang.String toString() {
final java.lang.StringBuilder sb = new java.lang.StringBuilder("{");
#set ($i = 0)
#foreach ($member in $members)#if ($i == 0)
sb.append("#####
#else
sb.append(",####
#end#if ($member.string || $member.date)
\"$member.name\":\"")
#else
\"$member.name\":")
#end#if ($member.primitiveArray || $member.objectArray)
.append(java.util.Arrays.toString($member.name));
#elseif ($member.string || $member.date)
.append($member.accessor).append('\"');
#else
.append($member.accessor);
#end#set ($i = $i + 1)
#end
sb.append('}');
return sb.toString();
}

  • 某个项目(绿色通道EJSP_V1.0.1.02_beta)的负责人因某种原因(调到其他部门)不再是此项目的仓库管理员,那么需要与同事进行交接,将仓库管理员改成该同事。另外,需要大概介绍一下项目的版本等信息。