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

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

nginx centos 服務(wù)開(kāi)機(jī)啟動(dòng)設(shè)置實(shí)例詳解

2024-08-30 12:22:32
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
這篇文章主要介紹了nginx centos 服務(wù)開(kāi)機(jī)啟動(dòng)設(shè)置實(shí)例詳解的相關(guān)資料,這里對(duì)服務(wù)開(kāi)機(jī)啟動(dòng)做了詳細(xì)的步驟介紹,需要的朋友可以參考下

nginx centos 服務(wù)開(kāi)機(jī)啟動(dòng)設(shè)置

建立服務(wù)文件

以nginx 為例

vim /lib/systemd/system/nginx.service 

在nginx.service 中插入一下內(nèi)容

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

[Unit]:服務(wù)的說(shuō)明
Description:描述服務(wù)
After:描述服務(wù)類別
[Service]服務(wù)運(yùn)行參數(shù)的設(shè)置
Type=forking是后臺(tái)運(yùn)行的形式
ExecStart為服務(wù)的具體運(yùn)行命令
ExecReload為重啟命令
ExecStop為停止命令
PrivateTmp=True表示給服務(wù)分配獨(dú)立的臨時(shí)空間
注意:[Service]的啟動(dòng)、重啟、停止命令全部要求使用絕對(duì)路徑

以754的權(quán)限保存在目錄:/lib/systemd/system 

設(shè)置開(kāi)機(jī)自啟動(dòng):

systemctl enable nginx.service

相關(guān)命令

功能                                       cnetos7以前                                          cnetos7
顯示所有已啟動(dòng)的服務(wù)            chkconfig --list                 systemctl list-units --type=service

啟動(dòng)某服務(wù)       service nginx start systemctl             start nginx.service 或 systemctl start nginx

停止某服務(wù)       service nginx stop systemctl             stop nginx.service 或 systemctl stop nginx

重啟某服務(wù)       service nginx restart                    systemctl restart nginx.service 或 systemctl restart nginx

使某服務(wù)自動(dòng)啟動(dòng)     chkconfig --level 3 nginx  on       systemctl enable nginx.service 或 systemctl enable nginx

使某服務(wù)不自動(dòng)啟動(dòng)     chkconfig --level 3 nginx off    systemctl disable nginx.service 或 systemctl disable nginx

檢查服務(wù)狀態(tài)       service nginx status                 systemctl is-active nginx.service (僅顯示是否)Activesystemctl status nginx.service (服務(wù)詳細(xì)信息)

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

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 新化县| 陵川县| 石狮市| 辽阳市| 石首市| 山东省| 侯马市| 朝阳市| 栾城县| 图们市| 永泰县| 阿拉善右旗| 永年县| 华阴市| 米脂县| 会昌县| 同江市| 徐闻县| 宿州市| 偏关县| 五莲县| 北宁市| 青川县| 福泉市| 宁国市| 岑溪市| 陆川县| 镇平县| 宜宾市| 定陶县| 仙游县| 刚察县| 荣昌县| 江陵县| 芮城县| 岳池县| 北川| 松溪县| 徐州市| 甘孜县| 石泉县|