public:it:nginx

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
public:it:nginx [2018/02/28 13:48] – 外部编辑 127.0.0.1public:it:nginx [2024/05/27 09:13] (当前版本) – [Tips] oakfire
行 2: 行 2:
   * 停止''nginx -s stop''   * 停止''nginx -s stop''
   * 重载配置 ''nginx -s reload''   * 重载配置 ''nginx -s reload''
 +===== Articles =====
 +  * [[http://tengine.taobao.org/book/index.html|Nginx开发从入门到精通-淘宝]]
 +===== 配置语法 =====
 +  * [[http://nginx.org/en/docs/|official docs]]
 +  * location 配置语法:[[http://nginx.org/en/docs/http/ngx_http_core_module.html#location|official doc]]<code nginx>location [ = | ~ | ~* | ^~ ] uri { ... }
 +location @name { ... }</code>
 +    * 默认(无标记)是前缀最长匹配;
 +    * ''='': 表示精确匹配才执行操作
 +    * ''~'': 表示执行正则匹配,且区分大小写
 +    * ''~*'': 表示执行正则匹配,但**不**区分大小写
 +    * ''^~'': 表示普通字符匹配,前缀匹配有效则配置直接生效,停止向下查找
 +    * ''@'' 自定义量
 +    * 匹配优先级官方文档:
 +      - Directives with the = prefix that match the query exactly. If found, searching stops.
 +      - All remaining directives with conventional strings, longest match first. If this match used the ^~ prefix, searching stops.
 +      - Regular expressions, in order of definition in the configuration file.
 +      - If #3 yielded a match, that result is used. Else the match from #2 is used.
 +    * 中文:
 +      - ''='' 的指令严格匹配这个查询。如果找到,停止搜索。
 +      - 所有剩下的常规字符串,最长的匹配。如果这个匹配到^〜前缀,搜索停止。
 +      - 正则表达式,在配置文件中定义的顺序。
 +      - 如果第3条规则产生匹配的话,结果被使用。否则,使用第2条规则的结果。
  
-===== 去除 server header 版本号 ===== +==== 去除 server header 版本号 ==== 
-  * 在 ''/etc/nginx/nginx.conf'' 里 http 下 添加 ''server tokens off'';修改 ''/etc/nginx/fastcgi_param'' 与 ''/etc/nginx/fastcgi.conf'' 下的对应条;+  * 在 ''/etc/nginx/nginx.conf'' 里 http 下 添加 ''server_tokens off''; 
 +  * 修改 ''/etc/nginx/fastcgi_param'' 与 ''/etc/nginx/fastcgi.conf'' 下的对应条''SERVER_SOFTWARE'';
   * 或者修改源码,或者用插件 :[[http://stackoverflow.com/questions/246227/how-do-you-change-the-server-header-returned-by-nginx]]   * 或者修改源码,或者用插件 :[[http://stackoverflow.com/questions/246227/how-do-you-change-the-server-header-returned-by-nginx]]
  
-===== 添加基本认证 =====+==== 添加基本认证 ====
   * [[https://www.nginx.com/resources/admin-guide/restricting-access-auth-basic/|Restricting access auth basic]]   * [[https://www.nginx.com/resources/admin-guide/restricting-access-auth-basic/|Restricting access auth basic]]
   * [[http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html|ngx_http_auth_basic_module]]   * [[http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html|ngx_http_auth_basic_module]]
  
 +==== Tips ====
 +  * [[https://github.com/vulhub/vulhub/tree/master/nginx/insecure-configuration|Nginx 配置错误导致漏洞]]
 +    * 用 ''$request_uri''代替 ''$uri''
 +  * [[https://github.com/yandex/gixy|检测nginx配置是否有安全问题的工具: gixy]]
 +  * nginx 转发直播视频流时一定要关掉代理缓存:''proxy_buffering off'', 不然会造成视频流的延时!
 +  * ''add_header'' 可以添加响应头字段,但它不会判断原字段是否存在,可能造成重复添加(比如cors头字段重复,浏览器会报错),此时可以考虑使用插件 ''more_set_headers'', 需额外安装模块并让 nginx 加载
  
  
  • public/it/nginx.1519796929.txt.gz
  • 最后更改: 2018/02/28 13:48
  • 127.0.0.1