内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

CentOS6.3添加nginx系統(tǒng)服務的實例詳解

服務器

CentOS6.3添加nginx系統(tǒng)服務的實例詳解

遂平網站建設公司創(chuàng)新互聯(lián)建站,遂平網站設計制作,有大型網站制作公司豐富經驗。已為遂平近1000家提供企業(yè)網站建設服務。企業(yè)網站搭建\外貿網站制作要多少錢,請找那個售后服務好的遂平做網站的公司定做!

前言:

今天虛擬機上配了下服務器整理了個這個 nginx 服務

要注意 - 短橫杠這個符號看看復制進去后有沒有亂碼,我之前就遇到這個問題,郁悶了好久才發(fā)現(xiàn)

提示:頂部的注釋不要去除否則無法注冊為系統(tǒng)服務,

關于:chkconfig: 2345 65 37

網上搜索總結了下意思是:

2345 為啟動該服務的系統(tǒng)環(huán)境 65 為加載的優(yōu)先級別 37 為關閉的優(yōu)先級別

65,37 這兩個位置的數(shù)值不能相同,也不能和其它服務的數(shù)值沖突,這個我也沒遇到過此類問題,如果有發(fā)現(xiàn)問題請對應自己的配置修改下好了

新建文件:

# vi /etc/init.d/nginx 

輸入內容:

#!/bin/sh 
# Comments to support chkconfig on RedHat Linux 
# chkconfig: 2345 65 37 
# description: A nginx daemon. 
                         
set -e 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 
DESC=nginx daemon 
NAME=nginx 
DAEMON=/usr/local/nginx/sbin/$NAME 
SCRIPTNAME=/etc/init.d/$NAME 
                         
# If the daemon file is not found, terminate the script. 
test -x $DAEMON || exit 0 
                         
d_test() { 
  $DAEMON -t 
} 
d_start() { 
  $DAEMON || echo -n  already running 
} 
d_stop() { 
  $DAEMON -s quit || echo -n  not running 
} 
d_reload() { 
  $DAEMON -s reload || echo -n  could not reload 
} 
                         
case $1 in 
  test) 
   d_test 
   echo . 
   ;; 
  start) 
   echo -n Starting $DESC: $NAME 
   d_start 
   echo . 
   ;; 
  stop) 
   echo -n Stopping $DESC: $NAME 
   d_stop 
   echo . 
   ;; 
  reload) 
   echo -n Reloading $DESC configuration... 
   d_reload 
   echo reloaded. 
   ;; 
  restart) 
   echo -n Restarting $DESC: $NAME 
   d_stop 
   # Sleep for two seconds before starting again, this should give the 
   # Nginx daemon some time to perform a graceful stop. 
   sleep 2 
   d_start 
   echo . 
   ;; 
  *) 
   echo Usage: $SCRIPTNAME {test|start|stop|restart|reload} >&2 
   exit 3 
   ;; 
esac 
                         
exit $? 

注冊 nginx 服務:

chmod +x /etc/init.d/nginx 
chkconfig --add nginx 
chkconfig --level 2345 nginx on 
chkconfig --list nginx 

相關 nginx 命令:

檢測 nginx 配置

# service nginx test 

啟動

# service nginx start 

關閉

# service nginx stop 

重啟

# service nginx restart 

重載配置

# service nginx reload 

如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

網頁名稱:CentOS6.3添加nginx系統(tǒng)服務的實例詳解
文章位置:http://www.rwnh.cn/article16/cpccdg.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供虛擬主機、外貿建站、外貿網站建設、靜態(tài)網站、定制開發(fā)、標簽優(yōu)化

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

網站建設網站維護公司
台南县| 临澧县| 五台县| 中西区| 专栏| 太和县| 萨嘎县| 琼海市| 游戏| 沅陵县| 双鸭山市| 汕尾市| 邢台市| 新蔡县| 新田县| 富裕县| 泰来县| 沙洋县| 柘城县| 奈曼旗| 博乐市| 疏勒县| 泸水县| 南城县| 亳州市| 巴青县| 平湖市| 翼城县| 宣化县| 安丘市| 班玛县| 新津县| 新安县| 西吉县| 临清市| 文登市| 遂平县| 桃源县| 沧州市| 林西县| 和静县|