openresty(nginx) 配置 stream 转发】的更多相关文章

nginx从1.9.0开始,新增加了一个stream模块,用来实现四层协议的转发.代理或者负载均衡等. (1)关于stream域的模块有哪些? 目前官网上列出的第三方模块.简直就是http模块的镜像.比如access模块访问控制ip和ip段,map模块实现映射. geo模块实现地理位置映射.等等.使用这些模块的时候一定要看是哪个版本才支持的.比如log模块,只有在nginx-1.11.4才支持. NGINX的stream相关模块有如下(有些模块特定版本才有,才支持,比如,log模块是NGINX的…
Nginx配置proxy_pass转发的/路径问题 在nginx中配置proxy_pass时,如果是按照^~匹配路径时,要注意proxy_pass后的url最后的/,当加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走. location ^~ /static_js/ { proxy_cache js_cache; proxy_set_header Host js.test.com; proxy_pass http:…
学习nginx 推荐 http://www.nginx.cn/nginx-how-to 1. 设置域名解析 daijun.me 指向 234.33.22.21 2.主机234.33.22.21 nginx配置 转发 server { listen 80; server_name daijun.me www.daijun.me; access_log /data/wwwlogs/access_nginx.log combined; # root /data/wwwroot/default; # i…
域名:cps.45wan.com   所在阿里云主机:123.35.9.12 45wan没有在阿里云备案 67wan已经在阿里云备案 阿里云主机(假如123.35.9.12)上原来的nginx配置: server {listen 80; server_name cps.45wan.com; root /home/web/cps.45wan.com/htdocs/www; location / { root /home/web/cps.45wan.com/htdocs/www; } locatio…
一.使用openSSL生成自签名的证书 1.生成RSA私钥 命令:openssl genrsa -des3 -out server.key 1024 说明:生成rsa私钥,des3算法,1024强度,server.key是秘钥文件名 2.生成证书签名请求CSR 命令: openssl req -new -key server.key -out server.csr -config openssl.cnf 说明:openssl.cnf是OpenSSL的配置文件,通常放在/usr/lib/ssl/o…
一.NGINX 1.9之前,需要安装第三方的TCP插件: http://www.cnblogs.com/i-blog/p/6165378.html 二.1.9之后直接使用Stream配置就可以了,当然需要先安装stream模块: 1.nginx 增加tcp./configure --with-stream --with-pcre=../pcre-8.38./configure --with-stream --without-http_rewrite_module2.配置nginx.conf st…
生成ssl证书: 1.首先要生成服务器端的私钥,运行时会提示输入密码,此密码用于加密key文件: openssl genrsa -des3 -out server.key 1024 2.去除key文件口令的命令: openssl rsa -in server.key -out server.key 3.生成根证书签发申请文件(csr文件) 使用上一步生成的私钥(pem文件),生成证书请求文件(csr文件) openssl req -new -key server.key -out server.…
请求原地址 :http://servername/static_js/test.html location ^~ /static_js/ { proxy_cache js_cache; proxy_set_header Host js.test.com; proxy_pass http://js.test.com/; } 或者 使用rewrite location ^~ /static_js/ {  proxy_cache js_cache;  proxy_set_header Host js.…
一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # 因为所有的地址都以 / 开头,所以这条规则将匹配到所有请求 # 但是正则和最长字符串会优先匹配 [ configuration B ] } location /documents/ { # 匹配任何以 /documents/ 开头的地址,匹配符合以后,还要继续往下搜索 # 只有后面的正则表达式没有匹配到时,这一条才会采用这一条 [ c…
场景:服务器F针对访问终端需要添加白名单操作,由到终端数量较多,所以用了一台代理服务器 P,在服务F中添加 服务器P IP地址的白名单,所有终端访问服务器P 由于我已经安装过 Nginx 所以只需要添加模块的配置,这里先说明 stream 四层代理的实现方式,(仅满足项目需要配置,其它配置项可百度参考相应的说明) 切换到安装目录下 [root@localhost nginx-1.12.2]# pwd /usr/local/iron/nginx-1.12.2 [root@localhost ngi…