debian – 使用systemd在启动时启动nginx
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了debian – 使用systemd在启动时启动nginx,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1588字,纯文字阅读大概需要3分钟。
内容图文
我刚刚在Debian 8服务器上安装了nginx 1.9.
nginx运行正常,当我告诉它运行时,但它似乎不会在启动时自动加载nginx.
我尝试过在互联网上推荐的众多init脚本,但还没有任何工作.所以现在我想用systemctl搞清楚.
~$systemctl status nginx
● nginx.service
Loaded: masked (/dev/null)
Active: inactive (dead)
~$sudo systemctl try-restart nginx
Failed to try-restart nginx.service: Unit nginx.service is masked.
~$sudo systemctl reload nginx
Failed to reload nginx.service: Unit nginx.service is masked.
~$sudo systemctl reload nginx
Failed to reload nginx.service: Unit nginx.service is masked.
不幸的是,我不知道“服务被掩盖”是什么意思,我不知道为什么它被掩盖了.
我跑的时候
sudo nginx
服务器运行得很好.那么,我研究了揭露nginx服务.
~$sudo systemctl unmask nginx.service
Removed symlink /etc/systemd/system/nginx.service.
好的很酷,现在我可以使用systemctl启动nginx.所以我检查了重启是否会自动加载nginx.但它没有这样做,我不知道从哪里开始.
有人可以帮我在启动时自动运行nginx吗?
解决方法:
您似乎混淆了启用,启动和掩码操作.
> systemctl start,systemctl stop:立即启动(停止)有问题的单元;
> systemctl enable,systemctl disable:在引导时标记(取消标记)自动启动的单元(以特定于单元的方式,在[Install]部分中描述);
> systemctl mask,systemctl unmask:disallows(允许)所有和任何尝试启动有问题的单元(手动或作为任何其他单元的依赖项,包括默认引导目标的依赖项).请注意,systemd中自动启动的标记是通过从默认引导目标向相关单元添加人为依赖项来实现的,因此“mask”也不允许自动启动.
所以,这些都是截然不同的操作.其中,您需要启用systemctl.
参考:systemctl(1).
更多:Lennart Poettering(2011-03-02). “The Three Levels of Off”. systemd for Administrators. 0pointer.de.
内容总结
以上是互联网集市为您收集整理的debian – 使用systemd在启动时启动nginx全部内容,希望文章能够帮你解决debian – 使用systemd在启动时启动nginx所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。