首页 技术 正文
技术 2022年11月19日
0 收藏 363 点赞 4,775 浏览 5470 个字

Tengine + Luajit2

系统账号及环境配置

sudo useradd -g 100 -u 200 user_00sudo groupadd -g 300 wwwsudo useradd -g 300 -u 300 -s /sbin/nologin wwwsudo mkdir -p /usr/local/services/srcsudo chown -R user_00.usrs /usr/local/servicessu - user_00cd /usr/local/services/src

LuaJIT部署

$ wget http://luajit.org/download/LuaJIT-2.1.0-beta2.tar.gztar xf LuaJIT-2.1.0-beta1.tar.gzcd LuaJIT-2.1.0-beta1make PREFIX=/usr/local/servicesmake install PREFIX=/usr/local/servicesecho "/usr/local/services/lib" |sudo tee -a /etc/ld.so.confsudo ldconfig

Tengine 部署

$ wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz$ wget ftp://ftp.lanet.lv/pub/unix/security/libmd5-0.8.2b.tar.gz$ wget https://sourceforge.net/projects/pcre/files/pcre/8.39/pcre-8.39.tar.gz/download$ wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz$ ./configure \--prefix=/usr/local/services/tengine-2.1.2 \--user=www \--group=www \--with-http_ssl_module \--with-http_lua_module \--with-http_realip_module \--with-http_stub_status_module \--with-http_gzip_static_module \--with-sha1=/usr \--with-openssl=/usr/local/services/src/openssl-1.0.2j \--with-md5=/usr/local/services/src/md5 \--with-pcre=/usr/local/services/src/pcre-8.39 \--with-luajit-inc=/usr/local/services/include/luajit-2.1 \--with-luajit-lib=/usr/local/services/lib \--without-select_module --without-poll_module \--without-http_userid_module \--without-mail_pop3_module \--without-mail_imap_module >/dev/nullmake >/dev/null && make install >/dev/null cd /usr/local/services/tengine-2.1.2mkdir {temp,conf/sites-{available,enabled}}sudo chown www.www temp

Tengine 主配置文件

cd /usr/local/services/tengine-2.1.2/confcat nginx.confuser www www;worker_processes 2;worker_cpu_affinity auto;pid        logs/nginx.pid;error_log  logs/error.log  error;#Specifies the value for maximum file descriptors that can be opened by this process.events {    use epoll;    worker_connections  102400;}worker_rlimit_nofile 102400;http {    include       mime.types;    server_info   off;    server_tokens off;    server_tag    off;    default_type  application/octet-stream;    real_ip_header X-Forwarded-For;    set_real_ip_from 172.31.0.0/16;    log_format main '$remote_addr - $remote_user [$time_local] "$request" '                    '$status $body_bytes_sent "$http_referer" '                    '"$http_user_agent" $request_time $upstream_response_time $host';    server_names_hash_bucket_size 256;    client_header_buffer_size 256k;    large_client_header_buffers 8 128k;    client_max_body_size    8m;    sendfile          on;    tcp_nopush        on;    tcp_nodelay       on;    keepalive_timeout 60;    proxy_connect_timeout 100s;    proxy_read_timeout 300;    proxy_send_timeout 300;    proxy_buffer_size 512k;    proxy_buffers  16 256k;    proxy_busy_buffers_size 512k;    proxy_temp_file_write_size 512k;    proxy_ignore_client_abort on;    gzip              on;    gzip_min_length   1k;    gzip_buffers      4 16k;    gzip_http_version 1.0;    gzip_comp_level   2;    gzip_types        text/plain application/javascript application/x-javascript text/css application/xml text/javascript;    gzip_vary         on;    charset           utf-8;    access_log        logs/access.log main;    log_not_found     off;    ssi               on;    ssi_silent_errors on;    ssi_types         text/shtml;    fastcgi_temp_path     temp/fastcgi_temp;    client_body_temp_path temp/client_body_temp;    proxy_temp_path       temp/proxy_temp;    scgi_temp_path        temp/scgi_temp;    uwsgi_temp_path       temp/uwsgi_temp;    #error_page  500 502 503 504      /50x.html;    #error_page  400 403 405 408 404  /40x.html;    req_status_zone server "$host" 256M;    req_status_zone_add_indicator server $limit;    upstream appname {        server 127.0.0.1:8000     weight=1;        server 127.0.0.2:8000     weight=1;        keepalive 600;        check interval=5000 rise=2 fall=5 timeout=1000 type=http;        check_keepalive_requests 100;        check_http_send "HEAD / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";        check_http_expect_alive http_2xx http_3xx;    }    server {        listen       80 default;        server_name  _;        return       444;        access_log   off;    }include sites-enabled/*.conf;}

Tomcat 动静分离

cd /usr/local/services/tengine-2.1.2/conf/sites-availablecat www.soa.com.confserver {    listen      80;    server_name www.soa.com;    root        /data/apps/soa/appname;    req_status  server;     location / {        index index.html index.jsp;        try_files $uri $uri/ @proxy;    }     location @proxy {        proxy_pass http://appname;    }     location ~ \.jsp$ {        proxy_redirect off;        proxy_pass http://www.esearchapi.com;        proxy_http_version 1.1;        proxy_set_header Connection "";        proxy_set_header Host $host;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    }     location ~ .*\.(js|css)?$ {        expires      12h;    }     location ~ .*\.(gif|jpg|jpeg|png|bmp)$ {        expires      1d;    }}

Tengine 运行状态,用于监控

cd /usr/local/services/tengine-2.1.2/conf/sites-availablecat 127.0.0.1.confserver {    listen          80;    server_name     127.0.0.1;    access_log      off;     set $limit 0;    if ($arg_limit = '1') { set $limit 1; }     location /stats {        stub_status on;    }       location /upstream_stats {        check_status;    }       location /request_stats {        req_status_show;        req_status_show_field req_total conn_total bytes_in bytes_out rt        http_200 http_404 http_403 http_500 http_502 http_503 http_504        http_2xx http_3xx http_4xx http_5xx http_other_status $limit;    }  }
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,994
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,507
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,350
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,135
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,768
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,845