国产探花免费观看_亚洲丰满少妇自慰呻吟_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 (服務詳細信息)

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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 靖安县| 米林县| 资中县| 清镇市| 平谷区| 吐鲁番市| 山阳县| 易门县| 北安市| 南靖县| 桃江县| 宽城| 新巴尔虎右旗| 石城县| 南平市| 苗栗县| 岳普湖县| 江华| 秀山| 新密市| 遂昌县| 安庆市| 高雄市| 万安县| 蒲江县| 武山县| 昆山市| 汝城县| 边坝县| 昌图县| 铜鼓县| 锡林浩特市| 鄂州市| 宜君县| 阳城县| 岐山县| 河北区| 桐乡市| 清新县| 山阴县| 石河子市|