1匀钧、對常用I/O模型進行比較說明
阻塞型IO:內(nèi)核的read調(diào)用是阻塞的,需要等待網(wǎng)卡到內(nèi)核緩沖區(qū);內(nèi)核到用戶緩沖區(qū)后才能返回梗肝;客戶端如果一直不發(fā)送數(shù)據(jù),服務端進程就會一直阻塞在read函數(shù)上不返回铺董,也無法接收其他客戶端的連接巫击;
非阻塞型IO:內(nèi)核提供了一個非阻塞的read函數(shù),數(shù)據(jù)到達前返回的都是錯誤值精续,而不是阻塞等待坝锰,需要循環(huán)調(diào)用read函數(shù),直到返回結(jié)果不為錯誤值為止重付;另外顷级,非阻塞只是體現(xiàn)在網(wǎng)卡到內(nèi)核緩沖區(qū)不阻塞,如果數(shù)據(jù)已經(jīng)到達內(nèi)核緩沖區(qū)确垫,需要完成內(nèi)核到用戶緩沖區(qū)的拷貝弓颈,這個過程還是阻塞的。
IO多用復用:用戶態(tài)可以通過一個循環(huán)删掀,不停遍歷系統(tǒng)調(diào)用read函數(shù)的狀態(tài)來判斷數(shù)據(jù)是否已經(jīng)就緒翔冀,但這樣就需要一直消耗系統(tǒng)資源。因此就需要內(nèi)核直接提供這樣的功能披泪,直接由內(nèi)核來遍歷fd的狀態(tài)纤子。能夠執(zhí)行這樣事務的函數(shù)包括select、poll和epoll等。
- select方式是用戶態(tài)進程將記錄了fd的數(shù)組拷貝到內(nèi)核控硼,內(nèi)核通過遍歷方式檢查fd的就緒狀態(tài)泽论,并返回可讀文件描述符的個數(shù),但具體哪個fd可讀還是要用戶態(tài)進程自己去遍歷象颖。
- epoll是在內(nèi)核中保存一份fd數(shù)組佩厚,后續(xù)用戶態(tài)進程只需要告知內(nèi)核修改的部分,內(nèi)核也不再執(zhí)行輪詢说订,而是通過異步IO事件喚醒抄瓦,內(nèi)核將有IO事件的fd返回給進程,進程也不需要去再次遍歷fd(分別通過epoll_create()創(chuàng)建file節(jié)點陶冷、epoll_ctl()用戶態(tài)傳遞fd到file節(jié)點钙姊、epoll_wait()等待epoll事件,返回給進程就緒的fd)埂伦。
信號驅(qū)動式IO:通過系統(tǒng)調(diào)用注冊信號處理的回調(diào)函數(shù)煞额,進程可以繼續(xù)執(zhí)行新的請求,這一步是不阻塞的沾谜;當有IO就緒時膊毁,內(nèi)核會回調(diào)注冊的信號回調(diào)函數(shù),進程會立即返回將數(shù)據(jù)復制到用戶緩沖區(qū)基跑,這一步是阻塞的婚温。
異步IO:所有工作由內(nèi)核全權完成,直到數(shù)據(jù)被復制到用戶空間媳否,內(nèi)核直接告知用戶進程IO已經(jīng)完成栅螟,兩個階段都是非阻塞的,因為內(nèi)核會完成數(shù)據(jù)到用戶空間的復制篱竭。
2力图、nginx中的模塊分類及常見核心模塊有哪些
模塊只要分為:核心模塊、標準HTTP模塊掺逼、可選HTTP模塊吃媒、Stream服務模塊和第三方模塊。
常見的核心模塊包括:
- ngx_core
- ngx_errlog
- ngx_conf
- ngx_events
- ngx_event
- ngx_epoll
- ngx_regex
3坪圾、描述nginx中worker_processes晓折、worker_cpu_affinity、worker_rlimit_nofile兽泄、worker_connections配置項的含義
- worker_processes:啟動worker進程的數(shù)量漓概,數(shù)值最好與服務器的CPU核數(shù)相匹配
- worker_cpu_affinity:將nginx的worker進程綁定到指定的CPU核心,綁定并不意味著當前nginx進程獨占一核CPU病梢,但是可以保證進程不會運行在其他核心上
- worker_rlimit_nofile:所有worker進程可以打開的文件數(shù)量上限胃珍,一個成功的網(wǎng)絡連接會對應到一個fd梁肿,除了調(diào)整這個參數(shù),還需要確認ulimit是否做了per-process限制觅彰;
- woker_connections:單個worker進程的最大并發(fā)連接數(shù)
4吩蔑、編譯安裝nginx,實現(xiàn)多域名 https
#!/bin/bash
#****************************************************************************************#
#Author: Yabao11
#QQ: what QQ填抬,no QQ
#Date: 2022-01-04
#FileName: nginx.sh
#URL: https://github.com/yabao11
#Description: Test Script
#Copyright (C): 2022 All rights reserved
#*******************************定義顏色*************************************************#
RED="\e[1;31m"
GREEN="\e[1;32m"
SKYBLUE="\e[1;36m"
YELLOW="\e[1;43m"
BLUE="\e[1;44m"
END="\e[0m"
RandomColor="\e[1;32m"
#****************************************************************************************#
function Ostype {
if grep -i -q "release 6" /etc/centos-release;then
echo Centos6
elif grep -i -q Centos-8 /etc/os-release;then
echo Centos
elif grep -i -q Centos-7 /etc/os-release;then
echo Centos7
elif grep -i -q Ubuntu /etc/os-release;then
echo Ubuntu
elif grep -i -q "RedHat" /etc/os-release;then
echo Redhat
fi
}
function color {
RES_COL=60
MOVE_TO_COL="echo -en \E[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \E[1;32m"
SETCOLOR_FAILURE="echo -en \E[1;31m"
SETCOLOR_WARNING="echo -en \E[1;33m"
SETCOLOR_NORMAL="echo -en \E[0m"
echo -n "$1" && $MOVE_TO_COL
echo -n "["
if [[ $2 = "success" || $2 = "0" ]]; then
${SETCOLOR_SUCCESS}
echo -n " OK "
elif [[ $2 = "failure" || $2 = "1" ]]; then
${SETCOLOR_FAILURE}
echo -n "FAILED"
else
${SETCOLOR_WARNING}
echo -n "WARNING"
fi
${SETCOLOR_NORMAL}
echo -n "]"
echo
}
function inputerror {
echo -en "輸入錯誤烛芬!"
echo -e "\E[${RES_COL}G["$RED"退出"$END"]"
}
function nginx_install {
yum -y install wget gcc pcre-devel openssl-devel zlib-devel > /dev/null || { color "軟件安裝失敗.." 1; return 1; }
[ -e ${file_path}/${nginx_file}.tar.gz ] || wget -P ${file_path}/ http://nginx.org/download/${nginx_file}.tar.gz > /dev/null || { color "文件下載失敗.." 1; return 1; }
tar xf ${file_path}/${nginx_file}.tar.gz -C ${file_path}/ > /dev/null || { color "文件解壓縮失敗.." 1; return 1; }
useradd -r -M -s /sbin/nologin nginx
cd ${file_path}/${nginx_file} || { color "找不到目錄.." 1;return 1; }
if [ $# -gt 4 ];then
./configure $* > /dev/null && color "configure成功.." 0 || { color "configure失敗.." 1; return 1; }
make -j `lscpu | awk 'NR==4{print $2}'` > /dev/null && color "make成功!" 0 || { color "make失敗.." 1; return 1; }
#如果直接在腳本后面提供了nginx版本,則安裝該版本的nginx飒责,可使用默認參數(shù)赘娄,或用戶自己指定參數(shù)
else
[ ]
if [ -e ${nginx_path} ]; then
read -p "/data/nginx 文件已存在,是否強制安裝(會直接刪除/data/nginx)宏蛉?(yes or no)" askuser
askuser=`echo $askuser | tr 'A-Z' 'a-z'`
case $askuser in
y|yes)
rm -rf /data/nginx
;;
n|no)
exit
;;
*)
inputerror
exit
;;
esac
else
echo -e $GREEN"開始執(zhí)行configure.."$END
fi
read -p "你是否想要使用腳本默認的參數(shù)安裝遣臼?(回車使用默認參數(shù),或輸入自己的參數(shù))" readpref
[ -v readpref ] && echo -e "警告拾并!你自行輸入了編譯參數(shù)揍堰,路徑參數(shù)除了--prefix=之外,不要定義其他路徑參數(shù)嗅义!給你2秒確認一下捧弃。"$END; sleep 2;
if [[ $readpref =~ path ]];then
read -p "還有path參數(shù)在里面...真的不能帶path躁染,你確定要繼續(xù)寂汇?" readaction
readaction=`echo $readaction | tr 'A-Z' 'a-z'`
case $readaction in
y|yes)
;;
n|no)
exit
;;
*)
inputerror
exit
;;
esac
fi
default_statement=(${readpref:="--prefix=${nginx_path} --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module"})
[ ${#default_statement[*]} -gt 4 ] && echo -e $GREEN"開始執(zhí)行configure.."$END || exit;
[ -v readpref ] && nginx_path=${default_statement[0]#*=}
./configure ${default_statement[*]} > /dev/null && color "configure成功.." 0 || { color "configure失敗.." 1; exit; }
make -j `lscpu | awk 'NR==4{print $2}'` > /dev/null && color "make成功!" 0 || { color "make失敗.." 1; exit; }
make install > /dev/null && color "install成功!" 0 || { color "install失敗.." 1; exit; }
mkdir -p ${nginx_path}/run
mkdir ${nginx_path}/conf/conf.d
chown -R nginx.nginx ${nginx_path}
[ -e /usr/sbin/nginx ] && { color "nginx軟鏈接存在罐呼,需刪除" 2; rm -rf /usr/sbin/nginx; }
ln -s ${nginx_path}/sbin/nginx /usr/sbin/ &> /dev/null || color "/usr/sbin/nginx創(chuàng)建失敗,請自行創(chuàng)建鏈接.." 1
cat > /usr/lib/systemd/system/nginx.service <<EOF
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=${nginx_path}/run/nginx.pid
ExecStart=/usr/sbin/nginx -c ${nginx_path}/conf/nginx.conf
ExecReload=/bin/sh -c "/bin/kill -s HUP \$(/bin/cat ${nginx_path}/run/nginx.pid)"
ExecStop=/bin/sh -c "/bin/kill -s TERM \$(/bin/cat ${nginx_path}/run/nginx.pid)"
[Install]
WantedBy=multi-user.target
EOF
chown nginx.nginx /usr/lib/systemd/system/nginx.service
color "服務配置完畢继控,請自行啟動!" 2
tar -P -zcf ${file_path}/${nginx_file}/man/nginx.8.gz ${file_path}/${nginx_file}/man/nginx.8
mv ${file_path}/${nginx_file}/man/nginx.8.gz /usr/share/man/man8/
color "man幫助配置完畢胖眷!" 0
nginx_config
systemctl daemon-reload
fi
}
function nginx_config {
[ -e ${nginx_path}/conf/nginx.conf ] || { color "文件沒找到.." 1; exit; }
sed -i.bak -r -e "s/#user.*/user nginx nginx;/" \
-e "s/worker_processes.*/worker_processes auto;/" \
-e "/#error\_log\ \ logs\/error\.log;/i\error_log logs/error.log warn;\npid ${nginx_path}/run/nginx.pid;\nworker_rlimit_nofile 65536;" \
-e "/[[:space:]]+worker\_connections.*/i\use epoll;\naccept_mutex on;\nmulti_accept on;\n" \
-e "s/[[:space:]]+worker_connections.*/worker_connections 65536;/" \
-e "s/[[:space:]]+keepalive_timeout.*/keepalive_timeout 65 65;/" \
-e "/[[:space:]]+# HTTPS server/i\keepalive_requests 3;\ninclude ${nginx_path}/conf/conf.d/*.conf;\n" ${nginx_path}/conf/nginx.conf && { color "配置文件修改成功武通!" 0; echo -e $GREEN"你可以將服務器配置放在${nginx_path}/conf/conf.d/*.conf中。"$GREEN; }
}
function RootCA {
CAsubject="/C=CN/ST=Shanghai/O=MXX Company Ltd,/CN=MxxRootCA"
local con
if ! [ -d /etc/pki/CA ];then
echo -e $GREEN"CA目錄不存在珊搀,開始創(chuàng)建CA目錄..."$END
mkdir -pv ${cafile_path}{certs,crl,newcerts,private}
touch ${cafile_path}index.txt
echo -n 01 > ${cafile_path}serial
echo -n 01 > ${cafile_path}crlnumber
openssl req -newkey rsa:2048 -subj "$CAsubject" -keyout ${cafile_path}private/cakey.pem -nodes -days 3650 -x509 -out ${cafile_path}cacert.pem
else
! [ -e ${cafile_path}index.txt ] && { touch ${cafile_path}index.txt;echo -e $GREEN"index.txt創(chuàng)建成功冶忱!"$END;}
! [ -e ${cafile_path}serial ] && { echo -n 01 > ${cafile_path}serial;echo -e $GREEN"serial創(chuàng)建成功!"$END;}
! [ -e ${cafile_path}crlnumber ] && { echo -n 01 > ${cafile_path}crlnumber;echo -e $GREEN"crlnumber創(chuàng)建成功境析!"$END;}
if ! [ -e ${cafile_path}private/cakey.pem -o -e ${cafile_path}cacert.pem ];then
echo -e $GREEN"生成cakey.pem|cacert.pem文件..."$END
openssl req -utf8 -newkey rsa:2048 -subj "$CAsubject" -keyout ${cafile_path}private/cakey.key -nodes -days 3650 -x509 -out ${cafile_path}cacert.crt
fi
fi
if [ $? -eq 0 ];then
color "設備配置為RootCA成功囚枪!" 0
else
color "RootCA配置失敗劳淆!" 1
return
fi
}
function certgen {
read -p "你想自己設置證書參數(shù)么链沼?(yes or no)" certset
certset=`echo $certset | tr 'A-Z' 'a-z'`
case $certset in
y|yes)
while ((num<2));do
read -p "輸入你希望為哪個站點申請證書?(如:*.mxx.com):" sub
manualSubject="/C=CN/ST=Shanghai/O=MXX Company Ltd,/CN="${sub}
read -p "輸入你證書的名稱:" pkiname
openssl req -newkey rsa:2048 -subj "$manualSubject" -keyout ${cafile_path}private/${pkiname}.key -nodes -out ${cafile_path}${pkiname}.csr &> /dev/null && color "csr生成成功沛鸵!" 0 || { color "csr生成失敗.." 1;exit; }
#生成的證書前面帶了一堆狀態(tài)信息
#openssl ca -days 3650 -in ${cafile_path}${pkiname}.csr -cert ${cafile_path}cacert.pem -keyfile ${cafile_path}private/cakey.pem -out ${cafile_path}certs/${pkiname}.crt -batch &> /dev/null && color "證書生成成功括勺!" 0 || { color "證書生成失敗.." 1;exit; }
openssl x509 -req -in ${cafile_path}${pkiname}.csr -CA ${cafile_path}cacert.pem -CAkey ${cafile_path}private/cakey.pem -CAcreateserial -days 3650 -CAserial ${cafile_path}serial -out ${cafile_path}certs/${pkiname}.crt &> /dev/null && color "證書生成成功缆八!" 0 || { color "證書生成失敗.." 1;exit; }
echo -e $GREEN"*************;*************************生成證書信息**************************************"$END
cat ${cafile_path}certs/${pkiname}.crt | openssl x509 -noout -subject -dates -serial
chmod 600 ${cafile_path}private/*.key
echo "證書生成完成"
echo -e $GREEN"**************************************生成證書文件如下**************************************"$END
echo "證書存放目錄: "${cafile_path}certs/
echo "證書文件列表: "`ls -t1 ${cafile_path}certs/${pkiname}*`
while true;do
read -p "是否希望合并根證書和服務器證書?" askuser2
askuser2=`echo $askuser2 | tr 'A-Z' 'a-z'`
case $askuser2 in
y|yes)
cat ${cafile_path}certs/${pkiname}.crt ${cafile_path}cacert.pem > /root/${pkiname}_merge.pem && color "合并后的證書的存放位置在/root/"${pkiname}"_merge.pem" 0 || color "證書合并失敗.." 1
break
;;
n|no)
break
;;
*)
inputerror
continue
;;
esac
done
while true;do
read -p "是否需要繼續(xù)生成證書疾捍?" askuser3
askuser3=`echo $askuser3 | tr 'A-Z' 'a-z'`
case $askuser3 in
y|yes)
num=1
break
;;
n|no)
break 3
;;
*)
inputerror
break
;;
esac
done
done
;;
n|no)
local INPUT
read -p "生成多少個證書奈辰?" INPUT
for((i=1;i<=$INPUT;i++));do
local Rand=`openssl rand -base64 6|sed -rn 's/[/+]//g;p'`
[ $INPUT -eq 2 ] && DN=([1]=Master [2]=Slave) || DN[$i]="centos-$i"
ClientSubject="/C=CN/ST=Shanghai/O=MXX Company Ltd,/OU=$Rand/CN=${DN[$i]}.mxx.com"
openssl req -newkey rsa:2048 -subj "$ClientSubject" -keyout ${cafile_path}private/user-${Rand}.key -nodes -out ${cafile_path}user-${Rand}.csr &> /dev/null
#openssl ca -days 3650 -in ${cafile_path}user-${Rand}.csr -cert ${cafile_path}cacert.pem -keyfile ${cafile_path}private/cakey.pem -out ${cafile_path}certs/user-${Rand}.crt -batch &> /dev/null
#下面的命令雖然可以生成證書,但不會寫index文件
openssl x509 -req -in ${cafile_path}user-${Rand}.csr -CA ${cafile_path}cacert.pem -CAkey ${cafile_path}private/cakey.pem -CAcreateserial -days 3650 -CAserial ${cafile_path}serial -out ${cafile_path}certs/user-${Rand}.crt
echo -e $GREEN"*************;*************************生成證書信息**************************************"$END
cat ${cafile_path}certs/user-${Rand}.crt | openssl x509 -noout -subject -dates -serial
done
chmod 600 ${cafile_path}private/*.key
echo "證書生成完成"
echo -e $GREEN"**************************************生成證書文件如下**************************************"$END
echo "證書存放目錄: "${cafile_path}certs/
echo "證書文件列表: "`ls -t1 ${cafile_path}certs/ | head -n $INPUT`
;;
*)
inputerror
;;
esac
}
function csrgen {
local cafile_path=/etc/pki/CA/
local capath
local days
read -p "CSR文件的文件路徑和文件名(如:/root/xxx.csr)乱豆?" capath
read -p "CSR文件的有效期奖恰?" days
local crtfile=`echo "$capath" | sed -r -n 's/(.*)\.csr/\1/p'`
openssl ca -days $days -in $capath -cert ${cafile_path}cacert.pem -keyfile ${cafile_path}private/cakey.pem -out ${crtfile}.crt -batch &> /dev/null
echo -e $GREEN"**************************************生成證書信息**************************************"$END
cat ${crtfile}.crt | openssl x509 -noout -subject -dates -serial
echo "證書生成完成"
echo -e $GREEN"**************************************生成證書文件如下**************************************"$END
echo "證書存放目錄: "${crtfile}
}
function config_https {
local nginx_conf=`find / -type d -name conf.d | grep nginx`
read -p "輸入網(wǎng)站的名字:" website
read -p "輸入你證書的文件名(應該是xxx_merge):" pkiname2
[ -e "/root/${pkiname2}.pem" ] || { color "證書不存在.." 1;exit; }
[ -e ${nginx_conf}/server${i}.conf ] && ((i++));
cat > ${nginx_conf}/server${i}.conf <<EOF && color "配置文件生成成功" 0 || { color "配置文件生成失敗.." 1; exit; }
server {
listen 80;
listen 443 ssl;
server_name ${website};
ssl_certificate /root/${pkiname2}.pem;
ssl_certificate_key /etc/pki/CA/private/${pkiname2%_*}.key;
ssl_session_cache shared:sslcache:20m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
root /data/server${i};
location / {
index index.html;
if ( \$scheme = http ) {
rewrite ^/(.*)$ https://${website}/\$1 redirect;
}
}
}
EOF
mkdir /data/server${i}
cat > /data/server${i}/index.html <<EOF
<h1>This is my server${i}, website doamin name is ${website}!</h1>
EOF
[ $? -eq 0 ] && color "配置成功!" 0 || color "配置失敗.." 1
}
#變量
nginx_file=${1:-nginx-1.18.0}
nginx_path=/data/nginx
file_path=/usr/local/src
cafile_path=/etc/pki/CA/
if [ $# -eq 1 ];then
if [ "$1" == --help ];then
echo -e $GREEN"命令格式:"$END
echo -e $SKYBLUE"./"`basename ./$0`" --help:查看幫助"$END
echo -e $SKYBLUE"./`basename ./$0` NGINX_VERSION:編譯安裝對應版本的nginx(使用默認編譯選項)"$END
echo -e $SKYBLUE"./`basename ./$0`:查看菜單項"$END
else
nginx_install ${nginx_file} || { color "安裝失敗宛裕,參數(shù)錯誤瑟啃!" 1;exit; }
fi
else
j=1
PS3="請選擇您要執(zhí)行的操作!:"
MENU="
默認選項安裝nginx
nginx補充新模塊(僅編譯续滋,不安裝)翰守,用于添加新模塊
配置nginx
配置RootCA,生成自簽名證書
生成服務器證書
配置HTTPS服務
查看命令幫助
退出
"
select M in $MENU ;do
case $REPLY in
1)
nginx_install
;;
2)
read -p "你是否想要自行提供編譯參數(shù)(至少4個)疲酌?(直接回車使用我給你定義的參數(shù))" askpref
install_statement=${askpref:="--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib64/nginx/modules \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/data/nginx/log/nginx/error.log \
--http-log-path=/data/nginx/log/nginx/access.log \
--pid-path=/data/nginx/run/nginx.pid \
--lock-path=/data/nginx/run/nginx.lock \
--http-client-body-temp-path=/data/nginx/cache/nginx/client_temp \
--http-proxy-temp-path=/data/nginx/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/data/nginx/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/data/nginx/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/data/nginx/cache/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--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"}
nginx_install ${install_statement}
;;
3)
nginx_config
;;
4)
[ -e /etc/pki/CA ] && rm -rf /etc/pki/CA
RootCA
;;
5)
read -p "您是否有csr文件蜡峰?(yes or no)" csrfileyes
csrfileyes=`echo $csrfileyes | tr 'A-Z' 'a-z'`
case $csrfileyes in
y|yes)
csrgen
;;
n|no)
certgen
;;
*)
inputerror
;;
esac
;;
6)
i=1
while true;do
config_https
read -p "是否需要繼續(xù)生成下一個網(wǎng)站?" askuser4
askuser4=`echo $askuser4 | tr 'A-Z' 'a-z'`
case $askuser4 in
y|yes)
((i++))
continue
;;
n|no)
break 2
;;
*)
inputerror
break 2
;;
esac
done
;;
7)
echo -e $GREEN"命令格式:"$END
echo -e $SKYBLUE"./"`basename ./$0`" --help:查看幫助"$END
echo -e $SKYBLUE"./`basename ./$0` NGINX_VERSION:編譯安裝對應版本的nginx(使用默認編譯選項)"$END
echo -e $SKYBLUE"./`basename ./$0`:查看菜單項"$END
;;
*)
exit
;;
esac
done
fi
#--prefix=/data/nginx --user=nginx --group=nginx --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 --add-module=/usr/local/src/echo-nginx-module
執(zhí)行結(jié)果: