国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 網(wǎng)站 > Nginx > 正文

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

2024-08-30 12:29:14
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

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

前言:

今天虛擬機(jī)上配了下服務(wù)器整理了個(gè)這個(gè) nginx 服務(wù)

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

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

關(guān)于:chkconfig: 2345 65 37

網(wǎng)上搜索總結(jié)了下意思是:

  • 2345 為啟動(dòng)該服務(wù)的系統(tǒng)環(huán)境
  • 65   為加載的優(yōu)先級(jí)別
  • 37   為關(guān)閉的優(yōu)先級(jí)別

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

新建文件:

# vi /etc/init.d/nginx 

輸入內(nèi)容:

#!/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 $? 

注冊(cè) nginx 服務(wù):

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

相關(guān) nginx 命令:

檢測(cè) nginx 配置

# service nginx test 

啟動(dòng)

# service nginx start 

關(guān)閉

# service nginx stop 

重啟

# service nginx restart 

重載配置

# service nginx reload 

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


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 新田县| 大悟县| 昌乐县| 天长市| 中牟县| 新蔡县| 波密县| 年辖:市辖区| 常宁市| 洞头县| 定安县| 左云县| 绍兴县| 穆棱市| 绥德县| 都江堰市| 金华市| 建平县| 城市| 靖西县| 攀枝花市| 祁东县| 天气| 泸定县| 石棉县| 德安县| 富裕县| 丹江口市| 临安市| 南京市| 汕尾市| 湟中县| 时尚| 阿坝县| 个旧市| 楚雄市| 柯坪县| 玉溪市| 明星| 瓦房店市| 涡阳县|