Skip to content

Commit 820f455

Browse files
author
gclm
committed
fix(优化tengine安装)
1 parent 6adeb7c commit 820f455

File tree

2 files changed

+43
-5
lines changed

2 files changed

+43
-5
lines changed

config/nginx/nginx.conf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
user www;
2+
worker_processes 1;
3+
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
}
10+
11+
http {
12+
include /etc/nginx/mime.types;
13+
default_type application/octet-stream;
14+
15+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
16+
'$status $body_bytes_sent "$http_referer" '
17+
'"$http_user_agent" "$http_x_forwarded_for"';
18+
19+
access_log /var/log/nginx/access.log main;
20+
21+
sendfile on;
22+
#tcp_nopush on;
23+
24+
keepalive_timeout 65;
25+
26+
#gzip on;
27+
28+
include /etc/nginx/conf.d/*.conf;
29+
}
30+

include/tengine-2.3.2.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
init(){
44
#1. 安装依赖包
5-
yum -y install gcc gcc-c++ bzip2 perl curl curl-devel expat-devel gettext-devel openssl-devel libxml2 libxml2-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel autoconf
5+
yum -y install gcc gcc-c++ bzip2 perl wget curl curl-devel expat-devel gettext-devel openssl-devel libxml2 libxml2-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel autoconf
66
#2. 配置扩展包安装源
77
yum -y install epel-release
88
yum -y install libmcrypt libmcrypt-devel mcrypt mhash
99
#3. 安装编译所需要的组件
10-
cd /usr/local/src && wget https://gclm.coding.net/p/yum/d/yum/git/raw/master/pcre-8.44.tar.gz && tar zxvf pcre-8.44.tar.gz && cd pcre-8.44 && ./configure --prefix=/usr/local/pcre && make && make install
10+
cd /usr/local/src && wget https://gclm.coding.net/p/yum/d/yum/git/raw/master/pcre-8.44.zip && unzip pcre-8.44.zip && cd pcre-8.44 && ./configure --prefix=/usr/local/pcre && make && make install
1111
cd /usr/local/src && wget https://gclm.coding.net/p/yum/d/yum/git/raw/master/zlib-1.2.11.tar.gz && tar zxvf zlib-1.2.11.tar.gz && cd zlib-1.2.11 && ./configure --prefix=/usr/local/zlib && make && make install
1212
cd /usr/local/src && wget https://gclm.coding.net/p/yum/d/yum/git/raw/master/jemalloc-5.2.1.tar.bz2 && tar xvf jemalloc-5.2.1.tar.bz2 && cd jemalloc-5.2.1 && ./configure --prefix=/usr/local/jemalloc && make && make install
1313
cd /usr/local/src && wget https://gclm.coding.net/p/yum/d/yum/git/raw/master/openssl-1.1.1d.tar.gz && tar zxvf openssl-1.1.1d.tar.gz && cd openssl-1.1.1d && ./config --prefix=/usr/local/openssl && make && make install
1414
cd /usr/local/src && git clone https://gitee.com/gclm/ngx_brotli.git
15-
rm -rf pcre-8.44.tar.gz
15+
rm -rf pcre-8.44.zip
1616
rm -rf zlib-1.2.11.tar.gz
1717
rm -rf jemalloc-5.2.1.tar.bz2
1818
rm -rf openssl-1.1.1d.tar.gz
@@ -22,7 +22,7 @@ install(){
2222
# 1. 下载
2323
cd /usr/local/src && wget https://tengine.taobao.org/download/tengine-2.3.2.tar.gz && tar -zxvf tengine-2.3.2.tar.gz && cd tengine-2.3.2
2424
# 2. 编译安装
25-
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=www --group=www --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module \
25+
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=www --group=www --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module \
2626
--with-pcre=/usr/local/src/pcre-8.44 \
2727
--with-openssl=/usr/local/src/openssl-1.1.1d \
2828
--with-jemalloc=/usr/local/src/jemalloc-5.2.1 \
@@ -53,9 +53,17 @@ ExecStop=/bin/kill -s TERM $MAINPID
5353
[Install]
5454
WantedBy=multi-user.target
5555
EOF
56+
# 添加用户和用户组
57+
groupadd -f www
58+
useradd -g www www
59+
# nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (2: ...tory)
60+
mkdir -p /var/cache/nginx/client_temp /var/cache/nginx/fastcgi_temp /var/cache/nginx/proxy_temp /var/cache/nginx/scgi_temp /var/cache/nginx/uwsgi_temp
61+
chmod 700 /var/cache/nginx/*
62+
# nginx 默认配置
63+
mkdir /etc/nginx/conf.d
64+
wget -O nginx.conf https://gitee.com/gclm/one-key-linux/raw/master/config/nginx/nginx.conf
5665
}
5766

58-
5967
main(){
6068
# 初始化环境,安装依赖库
6169
init

0 commit comments

Comments
 (0)