随笔分类 -  nginx

web服务
摘要:###1.nginx反向代理websocket原理 ###2.nginx配置文件详解 ####2.1 map值映射 ####2.2 upstream ####2.3 location ###3.nginx反向代理协议升级 ###1.nginx反向代理websocket原理 一般我们开发的WebSoc 阅读全文
posted @ 2023-02-27 13:25 老夫聊发少年狂88 阅读(7477) 评论(0) 推荐(0)
摘要:公司项目需要嵌套页面,同事查找到X-Frame-Options 这个nginx参数 在响应头里加一个X-Frame-Options DENY:浏览器拒绝当前页面加载任何Frame页面 SAMEORIGIN:frame页面的地址只能为同源域名下的页面 ALLOW-FROM origin:origin为 阅读全文
posted @ 2022-04-02 11:54 老夫聊发少年狂88 阅读(3289) 评论(0) 推荐(0)
摘要:限制单个IP的请求数量,减少DDOS攻击,节省服务器资源。 Syntax: limit_req zone=name [burst=number] [nodelay | delay=number]; Default: — Context: http, server, location Sets the 阅读全文
posted @ 2022-03-23 18:21 老夫聊发少年狂88 阅读(270) 评论(0) 推荐(0)
摘要:公司网站有很多图片,为防止图片被盗链,所以对nginx进行优化。 配置后所有盗链的图片都会失效。 Syntax: valid_referers none | blocked | server_names | string ...; Default: — Context: server, locati 阅读全文
posted @ 2022-03-23 15:49 老夫聊发少年狂88 阅读(136) 评论(0) 推荐(0)
摘要:路由器映射端口 伪装ip 信息 server { listen 80; server_name erp.rongbiz.com; # Add Headers for odoo proxy mode proxy_set_header X-Forwarded-Host $host; proxy_set_ 阅读全文
posted @ 2021-05-05 08:43 老夫聊发少年狂88 阅读(485) 评论(0) 推荐(0)
摘要:https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/ 阅读全文
posted @ 2021-04-28 16:58 老夫聊发少年狂88 阅读(49) 评论(0) 推荐(0)
摘要:使用 Nginx 搭建 HTTPS 正向代理服务 NGINX 搭建 HTTP 正向代理 最近帮同事搭建一个代理服务器,要求当请求的请求头中包含dest_ip时,就将请求转发到这个目的地址,否则就正常请求。当自己用下面这种方式很快就实现 HTTP 正向代理,信心满满的交给同事使用时,却发现这种配置无法 阅读全文
posted @ 2021-04-23 16:50 老夫聊发少年狂88 阅读(900) 评论(0) 推荐(0)
摘要:1.root path 设置web资源路径,用于指定请求的根文档目录,从根开始匹配 root:root/URI 2.alias path 指定路径别名,只能用于location中,从最后一个/开始匹配 alias: alias/ index file .... 定义默认页面,可以跟多个值,自左向右匹 阅读全文
posted @ 2021-04-23 11:39 老夫聊发少年狂88 阅读(119) 评论(0) 推荐(0)
摘要:###一. 会话保持sticky模块 ####情景: nginx的调度算法为rr wrr least_conn url_hash时,每次的访问不能沾滞到同一台服务器上 ####任务: 每次的请求都沾滞到同一台服务器上 不采用ip_hash调度算法 nginx负载均衡服务器前边如果是CDN会造成流量的 阅读全文
posted @ 2021-04-22 13:55 老夫聊发少年狂88 阅读(905) 评论(0) 推荐(0)
摘要:####调整打开文件数 vim /etc/security/limits.conf //针对root用户 root soft nofile 65535 root hard nofile 65535 //所有用户, 全局 * soft nofile 25535 * hard nofile 25535 阅读全文
posted @ 2021-04-21 14:39 老夫聊发少年狂88 阅读(78) 评论(0) 推荐(0)
摘要:####1.HTTPS基本概述 为什么需要使用HTTPS, 因为HTTP不安全 1.传输数据被中间人盗用, 信息泄露 2.数据内容劫持, 篡改 ####2.HTTPS配置语法 Syntax: ssl on | off; Default: ssl off; Context: http, server 阅读全文
posted @ 2021-04-20 11:43 老夫聊发少年狂88 阅读(113) 评论(0) 推荐(0)
摘要:####rewrite语法 | Syntax: | rewrite regex replacement [flag]; | | | | | Default: | — | | Context: | server, location, if | //所有请求转发到/pages/maintain.html 阅读全文
posted @ 2021-04-20 08:52 老夫聊发少年狂88 阅读(70) 评论(0) 推荐(0)
摘要:###1.缓存介绍 ####1.1 缓存的作用 ####1.2 缓存的分类 ####1.3 缓存校验流程 ####1.4 强制缓存 ####1.5 协商缓存 ####1.6 Cache-Control字段在请求和响应中的含义 ###2.nginx缓存之客户端缓存 ###1.缓存介绍 ####1.1 阅读全文
posted @ 2021-04-20 08:45 老夫聊发少年狂88 阅读(35) 评论(0) 推荐(0)
摘要:####1.准备站点目录 for i in {android,iphone,firefox,chrome,default} ;do mkdir /html/terminal/${i} && echo $i >/html/terminal/${i}/index.html ;done ####2.准备配 阅读全文
posted @ 2021-04-19 13:45 老夫聊发少年狂88 阅读(272) 评论(0) 推荐(0)
摘要:####1.准备静态资源 [root@RainGod bin]# cat /etc/nginx/conf.d/static.conf server{ listen 81; # server_name 185.184.223.120; root /html/code/image; index inde 阅读全文
posted @ 2021-04-19 11:34 老夫聊发少年狂88 阅读(51) 评论(0) 推荐(0)
摘要:####1.静态资源类型 Nginx作为静态资源Web服务器部署配置, 传输非常的高效, 常常用于静态资源处理, 请求, 动静分离 非服务器动态运行生成的文件属于静态资源 |类型| 种类| | | | |浏览器端渲染| HTML、CSS、JS| |图片| JPEG、GIF、PNG| |视频| FLV 阅读全文
posted @ 2021-04-17 11:21 老夫聊发少年狂88 阅读(101) 评论(0) 推荐(0)
摘要:####upstream 七层负载模块 Syntax: upstream name { ... } Default: — Context: http Example: upstream backend { server backend1.example.com weight=5; server 12 阅读全文
posted @ 2021-04-12 16:41 老夫聊发少年狂88 阅读(55) 评论(0) 推荐(0)
摘要:反向代理模式 Nginx配置模块 http websocket https ngx_http_proxy_module fastcgi ngx_http_fastcgi_module uwsgi ngx_http_uwsgi_module grpc ngx_http_v2_module ####pr 阅读全文
posted @ 2021-04-10 17:02 老夫聊发少年狂88 阅读(111) 评论(0) 推荐(0)
摘要:####目录索引 autoindex Syntax: autoindex on | off; Default: autoindex off; Context: http, server, location //autoindex常用参数 autoindex_exact_size off; 默认为on 阅读全文
posted @ 2021-04-09 16:42 老夫聊发少年狂88 阅读(70) 评论(0) 推荐(0)
摘要:####nginx程序日志配置说明 1.log_format定义日志格式语法 Syntax: log_format name [escape=default|json|none] string ...; #name是变量名 Default: log_format combined "..."; Co 阅读全文
posted @ 2021-04-08 13:58 老夫聊发少年狂88 阅读(80) 评论(0) 推荐(0)