用户工具

站点工具


linux:tengine

yum

yum install -y gcc gcc-c++ autoconf automake
xslt => libxml2/libxslt
geoip => libgeoip-dev

pcre

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
cd /usr/local/src
tar zxvf pcre-8.42.tar.gz
./configure --prefix=/usr/local/pcre

openssl

wget https://www.openssl.org/source/openssl-1.1.0h.tar.gz
./config --prefix=/usr/local/openssl

zlib

wget http://zlib.net/zlib-1.2.11.tar.gz
./configure -prefix=/usr/local/zlib

jemalloc

wget https://github.com/jemalloc/jemalloc/releases/download/5.0.1/jemalloc-5.0.1.tar.bz2
tar jxvf jemalloc-5.0.1.tar.bz2
./configure --prefix=/usr/local/jemalloc

tengine

wget http://tengine.taobao.org/download/tengine-2.2.2.tar.gz
./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-pcre=/usr/local/src/pcre-8.42 \
--with-openssl=/usr/local/src/openssl-1.1.0h \
--with-jemalloc=/usr/local/src/jemalloc-5.0.1 \
--with-zlib=/usr/local/src/zlib-1.2.11 \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_sysguard_module \
--with-http_concat_module \
--with-http_v2_module \
--with-http_secure_link_module \
--with-select_module \
--with-http_slice_module \
--with-http_random_index_module

openssl报错:vi auto/lib/openssl/conf,修改include、libssl.a、libcrypt.a路径
查看模块和指令:nginx -m查看已有模块,nginx -l查看指令,modules目录已有很多模块
手动下载concat模块:git clone git://github.com/alibaba/nginx-http-concat.git
nginx: [emerg] getpwnam(“nginx”) failed:useradd -s /sbin/nologin -M nginx,创建nginx用户

wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
./configure --prefix=/usr/local/tengine \
--user=nginx \
--group=nginx \
--with-pcre=/usr/local/src/pcre-8.42 \
--with-openssl=/usr/local/src/openssl-1.1.0h \
--with-jemalloc=/usr/local/src/jemalloc-5.2.1 \
--with-zlib=/usr/local/src/zlib-1.2.11 \
--add-module=modules/mod_dubbo \
--add-module=modules/ngx_backtrace_module \
--add-module=modules/ngx_http_concat_module \
--add-module=modules/ngx_http_footer_filter_module \
--add-module=modules/ngx_http_proxy_connect_module \
--add-module=modules/ngx_http_reqstat_module \
--add-module=modules/ngx_http_sysguard_module \
--add-module=modules/ngx_http_trim_filter_module \
--add-module=modules/ngx_http_upstream_dynamic_module \
--add-module=modules/ngx_http_upstream_check_module \
--add-module=modules/ngx_http_user_agent_module \
--add-module=modules/ngx_multi_upstream_module \
--add-module=modules/ngx_slab_stat \
--with-threads \
--with-file-aio \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-mail \
--with-stream
  • select、poll,高并发时不推荐
  • xslt,过滤转换xml请求
  • addition,输出过滤
  • image-filter,图片过滤,需要gd库
  • sub,允许响应时替换文本
  • geoio,创建ip地址相关变量
  • degradation,内存不足时返回204或444
  • stub_status,查看nginx的状态页

系统服务:vi /lib/systemd/system/nginx.service

[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

权限和自启

chmod 745 nginx.service
systemctl enable nginx.service
service start nginx
systemctl list-units --type=service #查看正运行服务

基础密码认证

printf "ttlsa:$(openssl passwd -crypt 123456)\n" >>conf/htpasswd
linux/tengine.txt · 最后更改: 2020/08/26 23:57 由 admin