tengine官方: http://tengine.taobao.org/ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin #QQ:917611 export PATH if [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, please use r
tengine官方: http://tengine.taobao.org/
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
#QQ:917611
export PATH
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install lnmp"
exit 1
else
printf "............................................\n"
printf "............................................\n"
printf "................welcome to tengine...........\n"
printf "............................................\n"
printf "............................................\n"
fi
sleep 3
if [ -s /etc/selinux/config ]; then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
fi
/etc/init.d/iptables save
iptables -F;iptables -X;iptables -Z;iptables -t nat -F;iptables -t nat -X;iptables -t nat -Z;
cat >>/etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
eof
cat >>/etc/sysctl.conf
fs.file-max=65535
eof
yum install gcc gcc-c++ autoconf automake make wget openssl openssl-devel zlib vim zlib-devel -y
tengine="tengine-1.4.2.tar.gz"
PCRE="pcre-8.31.tar.gz"
NGINX="/usr/local/nginx"
NGINX_CONFIG="/usr/local/nginx/conf/nginx.conf"
USER="www"
GROUP="www"
DATE=$(date +%Y%m%d)
VHOST="/usr/local/nginx/conf/vhost"
if [ -d /usr/local/nginx ];then
echo "Nginx already exists:/usr/local/nginx"
exit 0
fi
if [ ! -f ${tengine} ];then
wget http://tengine.taobao.org/download/${tengine}
fi
if [ ! -f ${PCRE} ];then
wget http://sourceforge.net/projects/pcre/files/pcre/8.31/${PCRE}
fi
tar xvf ${tengine};tar xvf ${PCRE} -C /usr/local
cd `echo ${tengine}|sed 's/.tar.gz//g'`
useradd -M -s /sbin/nologin ${USER}
./configure --user=${USER} --group=${GROUP} --prefix=/usr/local/nginx --with-http_concat_module --with-pcre=/usr/local/pcre-8.31/ --with-http_gzip_static_module --with-http_stub_status_module
make;make install
cat > ${NGINX_CONFIG}
user www;
worker_processes 2;
pid logs/nginx.pid;
events {
worker_connections 51200;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_buffers 4 8k;
gzip_http_version 1.0;
gzip_types text/plain application/x-javascript text/javascript text/css;
include vhost/*.conf;
}
eof
read -p "please input domain :" domain
read -p "please input webdir :" webdir
if [ ! -d ${VHOST} ];then
mkdir ${VHOST} -p
fi
cat > ${VHOST}/${domain}.conf
log_format ${domain} '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /usr/local/nginx/logs/access.log ${domain};
server {
charset utf-8;
listen 80;
server_name ${domain};
location / {
root ${webdir};
concat on;
index index.html index.htm;
}
}
eof
/usr/local/nginx/sbin/nginx
netstat -lnpt |grep nginx
运维随笔” 博客,谢绝转载!