分类

链接

2023 年 10 月
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > Others > 正文
共享办公室出租
使用tengine代替Nginx
Others 暂无评论 阅读(110)

有了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_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====================================
    }
}

 

============ 欢迎各位老板打赏~ ===========

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:使用tengine代替Nginx | Bruce's Blog

发表评论

留言无头像?