V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
hanyang
V2EX  ›  Linux

service nginx stop fail

  •  
  •   hanyang · 2016-12-09 09:50:05 +08:00 · 2549 次点击
    这是一个创建于 2688 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在 /etc/init.d/nginx 创建脚本并增加执行权限后,执行 service nginx stop 报下面的错:

    Failed to stop nginx.service: Unit nginx.service not loaded.
    

    是不是需要为 nginx 创建一个 unit file ?

    6 条回复    2016-12-10 10:23:05 +08:00
    raysonx
        1
    raysonx  
       2016-12-09 09:57:55 +08:00 via Android
    目测楼主用的是基于 systemd 的发行版。
    提示:
    1. /etc/systems/system/xxx.service
    2. systemctl enable xxx
    3.systemctl start xxx
    raysonx
        2
    raysonx  
       2016-12-09 09:58:47 +08:00 via Android
    更正, 1. /etc/systemd/system/xxx.service
    hanyang
        3
    hanyang  
    OP
       2016-12-09 10:38:50 +08:00
    @raysonx 蟹蟹 完美解决啦
    hanyang
        4
    hanyang  
    OP
       2016-12-09 10:39:20 +08:00
    @raysonx 顺便问下 为什么需要这样做?
    ryd994
        5
    ryd994  
       2016-12-10 01:12:51 +08:00 via Android
    这个意思是 nginx 没启动过,没启动当然没法停
    另外,你 daemon-reload 没?
    hanyang
        6
    hanyang  
    OP
       2016-12-10 10:23:05 +08:00
    @ryd994 没有。。 daemon-reload 是重新载入配置文件?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2839 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 13:34 · PVG 21:34 · LAX 06:34 · JFK 09:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.