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

首頁 > 網站 > 建站經驗 > 正文

nginx centos 服務開機啟動設置實例詳解

2019-11-02 16:28:02
字體:
來源:轉載
供稿:網友

nginx centos 服務開機啟動設置

建立服務文件

以nginx 為例

vim /lib/systemd/system/nginx.service 

在nginx.service 中插入一下內容

[Unit] Description=nginx After=network.target [Service] Type=forking ExecStart= 服務啟動命令ExecReload= 服務重啟命令ExecStop=服務停止命令PrivateTmp=true [Install] WantedBy=multi-user.target 

[Unit]:服務的說明

Description:描述服務

After:描述服務類別

[Service]服務運行參數的設置

Type=forking是后臺運行的形式

ExecStart為服務的具體運行命令

ExecReload為重啟命令

ExecStop為停止命令

PrivateTmp=True表示給服務分配獨立的臨時空間

注意:[Service]的啟動、重啟、停止命令全部要求使用絕對路徑

以754的權限保存在目錄:/lib/systemd/system 

設置開機自啟動:

systemctl enable nginx.service

相關命令

功能                                       cnetos7以前                                          cnetos7

顯示所有已啟動的服務            chkconfig --list                 systemctl list-units --type=service

啟動某服務       service nginx start systemctl             start nginx.service 或 systemctl start nginx

停止某服務       service nginx stop systemctl             stop nginx.service 或 systemctl stop nginx

重啟某服務       service nginx restart                    systemctl restart nginx.service 或 systemctl restart nginx

使某服務自動啟動     chkconfig --level 3 nginx  on       systemctl enable nginx.service 或 systemctl enable nginx

使某服務不自動啟動     chkconfig --level 3 nginx off    systemctl disable nginx.service 或 systemctl disable nginx

檢查服務狀態       service nginx status                 systemctl is-active nginx.service (僅顯示是否)Activesystemctl status nginx.service (服務詳細信息)

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乌恰县| 花莲市| 司法| 冷水江市| 荣昌县| 华安县| 甘孜县| 黄浦区| 虹口区| 扶风县| 招远市| 彰化市| 吉林省| 东台市| 榕江县| 黑龙江省| 黑山县| 阿瓦提县| 体育| 滦平县| 沙雅县| 房产| 沁源县| 阳江市| 长治市| 枝江市| 勐海县| 六盘水市| 静海县| 宕昌县| 平阳县| 韩城市| 东阳市| 珲春市| 同仁县| 扶沟县| 克拉玛依市| 郴州市| 永年县| 房山区| 大荔县|