使用tengine代替Nginx
有了nginx,为什么还要用tengine? 因为: #下载 https://tengine.taobao.org/ wget https://tengine.taobao.org/download/tengine-3.0.0.tar.gz tar -zxvf tengine-3.0.0.tar.gz cd tengine-3.0.0 #安装依赖 yum install pcre-devel yum -y install openssl openssl-devel ./configure --add-module=modules/ngx_http_upstream_check_module #./configure --add-module=./nginx_upstream_check_module --with-http_ssl_module --with-http_v2_module --with-stream --with-http_gz...
nginx添加nginx_upstream_check_module
#cd nginx source folder cd /usr/local/nginx/nginx-1.18.0 wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/refs/heads/master.zip unzip master.zip mkdir nginx_upstream_check_module mv nginx_upstream_check_module/* ./nginx_upstream_check_module/ ./configure --add-module=./nginx_upstream_check_module #if need ssl #./configure --add-module=./nginx_upstream_check_module --with-http_ssl_module #backup old nginx file mv /usr/local/n...
nginx上传文件超出默认大小限制,提示:413 Request Entity Too Large
Nginx 限制文件上传大小,相应配置参数:client_max_body_size 注意:该参数在nginx.conf中默认是没有配置的,不配置的情况下,nginx默认限制请求附件大小为:1M。 即:默认当你通过nginx代理上传附件,大于1M的文件时,浏览器会抛出如下异常。 处理方式: 找到nginx的配置文件nginx/conf/nginx.conf,在location块中,添加如下参数配置: client_max_body_size 10m; # 改为你需要的大小 这里是将client_max_body_size 10m; 参数配置在了location{ }中, 当然,该参数也可以在http{ }中设置:client_max_body...
nginx反向代理禁用缓存
今天遇到一个怪事,nginx+frp反向代理后,很多网站都重定向到了同一个网站,经排查, 是nginx反向代理缓存的过, 于是禁用缓存: #PROXY-START/ location / { expires 12h; if ($request_uri ~* "(php|jsp|cgi|asp|aspx)") { expires 0; } proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; ...
docker nginx
docker run -d --name=nginx -p 80:80 -v /root/nginx/conf/:/etc/nginx/conf.d/ -v /root/web:/usr/share/nginx/html nginx
consul+nginx完成集群服务动态发现和健康检查
前言 在《构建Consul集群》章节中介绍了如何实现consul集群的构建,通过对consul的进一步了解,其并没有提供的对cluster直接操作的client-api,故需要针对Consul集群构建一个统一入口,但这个并不需要我们过多的担心,Consul的小伙伴Consul-Template正是为此而生,通过Nginx+ConsulTemplate能够非常方便的实现,本章将来介绍如何配置应用并验证。 本章概要 1、准备工作; 2、Nginx配置; 3、编写ctmpl模板; 4、启动服务; 5、高可用集群验证; 准备工作 1、环境: Client节点:WIN10(192.168.6.78); Server节点...
nginx使用stream模块做ssh转发
nginx使用stream模块做ssh转发 一、前言 nginx从1.9.0开始,新增加了一个stream模块,用来实现四层协议的转发、代理或者负载均衡等。这完全就是抢HAproxy份额的节奏,鉴于nginx在7层负载均衡和web service上的成功,和nginx良好的框架,stream模块前景一片光明。 二、stream 模块编译 stream模块默认没有编译到nginx, 编译nginx时候 ./configure –with-stream 即可 官网:http://nginx.org/en/docs/stream/ngx_stream_core_module.html 三、使用stream模块做ssh转发 使用案例: 公司的测试主机在内网,不能直接访...
nginx反向代理wss
先上NGINX配置: worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 443 ssl http2; server_name localhost; ssl_certificate aa.pem; ssl_certificate_key aa.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_protocols TLSv1TLSv1....
nginx+keepalive负载均衡高可用
nginx搭建负载均衡详见: 这里不细说。下面说明一下怎么用keepalive实现Nginx高可用。 1、准备 两台浮在均衡服务器: 192.168.31.213 192.168.31.246 准备VIP(虚拟IP):192.168.31.31 2、为两台均衡服务器安装keepalive 准备依赖包: yum -y install gcc pcre-devel zlib-devel openssl-devel yum -y install popt-devel 下载 wget http://www.keepalived.org/software/keepalived-1.2.7.tar.gz 安装keepalive tar zxvf keepalived-1.2.7.tar.gz cd keepalived-1.2.7 ./configure make make instal...
nginx反向代理搭建谷歌镜像
nginx反向代理搭建谷歌镜像. 啥也不说了,直接上代码: server { listen 8000; server_name google.uol123.com; location / { #root "d:/wwwroot/test"; #index index.html; #proxy_redirect off; proxy_pass https://www.google.com.hk/; proxy_redirect / https://www.google.com.hk/; proxy_set_header Host www.google.com.hk; proxy_set_header X-Real-IP $remote_add...