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

首頁 > 網站 > Nginx > 正文

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

2024-08-30 12:28:21
字體:
來源:轉載
供稿:網友

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 (服務詳細信息)

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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 黎城县| 乌兰察布市| 库伦旗| 鲁山县| 东丰县| 乐亭县| 普兰县| 沅陵县| 宁国市| 松阳县| 吐鲁番市| 大埔县| 浑源县| 福建省| 如东县| 新化县| 扬中市| 阿鲁科尔沁旗| 普宁市| 赣州市| 广东省| 绥滨县| 香港| 封丘县| 临清市| 景谷| 黔西县| 漳浦县| 万荣县| 花莲县| 铁岭市| 朝阳区| 吉林市| 广昌县| 页游| 南江县| 苏尼特右旗| 秦安县| 灵璧县| 阜阳市| 遂平县|