使用tengine代替Nginx
因为:
#下载 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_gzip_static_module # 模块说明: # nginx_upstream_check_module 健康检查 # http_ssl_module, https # http_v2_module , http2 make #默认安装到/usr/local/nginx下面 sudo make install #查看版本 /usr/local/nginx/sbin/nginx -V #安装到全局 cp /usr/sbin/nginx /usr/sbin/nginx.bak cp ./objs/nginx /usr/sbin/ #查看及验证 nginx -t #启动 nginx #查看网站 curl localhost

参考Nginx.conf配置:
#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;
upstream xxxx{
server 127.0.0.1:9000;
server 127.0.0.1:8000;
# Enable health checks
check interval=3000 rise=2 fall=2 timeout=2000 type=http;
# HTTP settings for health checks
check_http_send "GET /api/health HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
server {
listen 80;
listen 443 ssl http2;
server_name xxxx.com;
location / {
root /usr/share/nginx/html;
#try_files $uri $uri/ /index.html;
index index.html;
}
location /status {
check_status;
access_log off;
}
ssl_certificate /usr/local/nginx/ssl/xxx.pem;
ssl_certificate_key /usr/local/nginx/ssl/xxx.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location /reservation/campaign/card/scanIt {
proxy_pass http://xxxx/api/reservation/campaign/card/scanIt;
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_connect_timeout 15s;
proxy_send_timeout 15s;
proxy_read_timeout 15s;
}
location /mp/ {
proxy_pass http://xxxx/;
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_connect_timeout 15s;
proxy_send_timeout 15s;
proxy_read_timeout 15s;
}
#proxy-end====================================
}
}
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · vue3+vite+多环境发面到二级目录配置
- · nginx http转https, 不带www转带www
- · nginx主动健康检查负载均衡模块
- · nginx自动切换到手机/PC 网站
- · nginx添加nginx_upstream_check_module
- · nginx上传文件超出默认大小限制,提示:413 Request Entity Too Large
- · nginx反向代理禁用缓存
- · docker nginx
- · consul+nginx完成集群服务动态发现和健康检查
- · nginx使用stream模块做ssh转发
- · nginx反向代理wss
- · nginx+keepalive负载均衡高可用
