重新启动没有sudo的nginx?

编程入门 行业动态 更新时间:2024-10-25 04:18:51
本文介绍了重新启动没有sudo的nginx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以我想能够上限:部署而不必键入任何密码。我已经设置了所有的私钥,所以我可以得到远程服务器的罚款,现在使用svn在ssh,所以没有密码在那里。

So I want to be able to cap:deploy without having to type any passwords. I have setup all private keys so I can get to the remote servers fine, and am now using svn over ssh, so no passwords there.

我有一个最后一个问题,我需要能够重新启动nginx。现在我有sudo /etc/init.d/nginx重新加载。这是一个问题b / c它使用capistrano密码,我刚刚删除b / c我正在使用密钥。任何关于如何重新启动nginx的想法w?输入密码?

I have one last problem, I need to be able to restart nginx. Right now I have sudo /etc/init.d/nginx reload. That is a problem b/c it uses the capistrano password, the one I just removed b/c I am using keys. Any ideas on how to restart nginx w\out a password?

推荐答案

我刚刚花了一个小时看着sudoer通配符,就像试图解决这个确切的问题。实际上,你真正需要的是一个可重新启动nginx的根脚本。

I just spent a good hour looking at sudoer wildcards and the like trying to solve this exact problem. In truth, all you really need is a root executable script that restarts nginx.

将它添加到/ etc / sudoers文件中

Add this to the /etc/sudoers file

username hostname ALL=NOPASSWD: /path/to/script

以root身份写脚本

#! /bin/bash /bin/kill -HUP `cat /var/run/nginx.pid`

使脚本可执行

测试。

sudo /path/to/script

更多推荐

重新启动没有sudo的nginx?

本文发布于:2023-10-28 17:55:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537362.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重新启动   sudo   nginx

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!