日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

centos下设置nginx,fdfs,docker开机自启动

發布時間:2023/12/13 综合教程 27 生活家
生活随笔 收集整理的這篇文章主要介紹了 centos下设置nginx,fdfs,docker开机自启动 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. 設置Nginx開機啟動

第一步:進入到/lib/systemd/system/目錄

# cd /lib/systemd/system/

第二步:創建nginx.service文件,并編輯

# vim nginx.service

內如如下:

[Unit]
Description=nginx service
After=network.target 
   
[Service] 
Type=forking 
ExecStart=/mytest/nginx/sbin/nginx
ExecReload=/mytest/nginx/sbin/nginx -s reload
ExecStop=/mytest/nginx/sbin/nginx -s quit
PrivateTmp=true 
   
[Install] 
WantedBy=multi-user.target

配置參數說明:

這里ExecStart ExecReload ExecStop 換成自己的啟動路徑;

[Unit]:服務的說明
Description:描述服務
After:描述服務類別
[Service]:服務運行參數的設置
Type=forking:是后臺運行的形式
ExecStart:為服務的具體運行命令
ExecReload:為重啟命令
ExecStop:為停止命令
PrivateTmp=True:表示給服務分配獨立的臨時空間
注意:[Service]的啟動、重啟、停止命令全部要求使用絕對路徑
[Install]運行級別下服務安裝的相關設置,可設置為多用戶,即系統運行級別為3

保存退出。

第三步:加入開機自啟動

# systemctl enable nginx

如果不想開機自啟動了,可以使用下面的命令取消開機自啟動

# systemctl disable nginx

第四步:服務的啟動/停止/刷新配置文件/查看狀態

# systemctl start nginx.service          啟動nginx服務

# systemctl stop nginx.service           停止服務

# systemctl restart nginx.service        重新啟動服務

# systemctl list-units --type=service     查看所有已啟動的服務

# systemctl status nginx.service          查看服務當前狀態

# systemctl enable nginx.service          設置開機自啟動

# systemctl disable nginx.service         停止開機自啟動

2設置FDFS開機啟動:

fdfs_tracker:

cp FastDFS/init.d/fdfs_trackerd /etc/init.d/
chkconfig –add fdfs_trackerd
chkconfig fdfs_trackerd on

fdfs_storafed:

cp FastDFS/init.d/fdfs_storaged /etc/init.d/
chkconfig –add fdfs_storaged
chkconfig fdfs_storaged on

3.設置docker開機啟動

docker 服務器開機自啟動:

1.systemctl is-enabled docker.service 檢查服務是否開機啟動
2.systemctl enable docker.service 將服務配置成開機啟動
3.systemctl start docker.service 啟動服務

systemctl 相關其他命令:
systemctl disable docker.service 禁止開機啟動
systemctl stop docker.service 停止服務
systemctl restart docker.service 重啟服務

總結

以上是生活随笔為你收集整理的centos下设置nginx,fdfs,docker开机自启动的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。