系統運維
1.nginx簡(jiǎn)介
常見(jiàn)WebServer(排行http://wap.friendlycc.com.cn/host/ http://wap.friendlycc.com.cn/host/ )
老牌:Httpd(早期叫Apache) ,開(kāi)源,市場(chǎng)份額最高
微軟:IIS
輕量:Lighttpd,性能高,低耗能,功能欠缺
Nginx誕生
2004年10月發(fā)布,俄國人Igor Sysoev開(kāi)發(fā),rambler.ru
Nginx官網(wǎng)、版本
nginx.org 1.14.0穩定版
國內分支Tengine(http://wap.friendlycc.com.cn/host/
Nginx功能介紹
Http服務(wù)、反向代理、負載均衡、郵件代理、緩存加速、SSL、flv/mp4流媒體
2.nginx安裝-yum安裝
vi /etc/yum.repos.d/nginx.repo
#http://wap.friendlycc.com.cn/host/
name=nginx repo
baseurl=http://wap.friendlycc.com.cn/host/
gpgcheck=0
enabled=1
yum install -y nginx
systemctl start/stop/restart/reload nginx
測試:瀏覽器訪(fǎng)問(wèn)或者curl訪(fǎng)問(wèn)
檢查服務(wù)進(jìn)程:ps aux |grep nginx
檢查端口監聽(tīng):netstat -lnp |grep ‘:80’
有防火墻,需加規則iptables -I INPUT -p tcp –dport 80 -j ACCEPT
nginx -V查看版本以及各個(gè)目錄、參數
下面是我的腳本自動(dòng)安裝的一個(gè)小模塊
OS_VERSION=rpm -q --queryformat \'%{VERSION}\' centos-release
echo "………………………………………..nginx…………………………………………."
cp /root/tools/nginx.repo /etc/yum.repos.d/
sed -i "s/6/$OS_VERSION/g" /etc/yum.repos.d/nginx.repo
yum install -y nginx
yum install -y libselinux-python
yum install -y telnet nc
cp /root/tools/nginx.conf /etc/nginx/nginx.conf".bakdate %F
"
cat /root/tools/nginx.conf > /etc/nginx/nginx.conf
if [[ "$OS_VERSION" = 6 ]]; then
setenforce 0 && chkconfig nginx on
elif [[ "$OS_VERSION" = 7 ]];then
setenforce 0 && systemctl enable nginx.service
fi
echo "…………………………………………nginx………………………………"
3.nginx安裝-源碼安裝
wget http://wap.friendlycc.com.cn/host/ //下載包
tar zxf nginx-1.14.0.tar.gz //解壓包
cd nginx-1.14.0
./configure –prefix=/usr/local/nginx //開(kāi)始編譯安裝
make && make install
/usr/local/nginx/sbin/nginx //啟動(dòng)
pkill nginx //殺死nginx進(jìn)程,停止nginx服務(wù)
/usr/local/nginx/sbin/nginx -t //檢測配置文件語(yǔ)法錯誤
/usr/local/nginx/sbin/nginx -s reload//重載配置
服務(wù)管理腳本
http://wap.friendlycc.com.cn/host/
chkconfig: – 30 21
description: http service.
Source Function Library
. /etc/init.d/functions
Nginx Settings
NGINX_SBIN="/usr/local/nginx/sbin/nginx"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/nginx/logs/nginx.pid"
RETVAL=0
prog="Nginx"
start()
{
echo -n $"Starting $prog: "
mkdir -p /dev/shm/nginx_temp
daemon $NGINX_SBIN -c $NGINX_CONF
RETVAL=$?
echo
return $RETVAL
}
stop()
{
echo -n $"Stopping $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -TERM
rm -rf /dev/shm/nginx_temp
RETVAL=$?
echo
return $RETVAL
}
reload()
{
echo -n $"Reloading $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -HUP
RETVAL=$?
echo
return $RETVAL
}
restart()
{
stop
start
}
configtest()
{
$NGINX_SBIN -c $NGINX_CONF -t
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
configtest)
configtest
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|configtest}"
RETVAL=1
esac
exit $RETVAL
更多關(guān)于云服務(wù)器,域名注冊,虛擬主機的問(wèn)題,請訪(fǎng)問(wèn)特網(wǎng)科技官網(wǎng):wap.friendlycc.com.cn
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。
Copyright ? 2009-2022 56dr.com. All Rights Reserved. 特網(wǎng)科技 特網(wǎng)云 版權所有 特網(wǎng)科技 粵ICP備16109289號
域名注冊服務(wù)機構:阿里云計算有限公司(萬(wàn)網(wǎng)) 域名服務(wù)機構:煙臺帝思普網(wǎng)絡(luò )科技有限公司(DNSPod) CDN服務(wù):阿里云計算有限公司 百度云 中國互聯(lián)網(wǎng)舉報中心 增值電信業(yè)務(wù)經(jīng)營(yíng)許可證B2
建議您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流瀏覽器瀏覽本網(wǎng)站