为什么运行“apachectl -k start”会失败? 不起作用,但“sudo apachectl -k start” 做?

发布于 2024-07-22 00:48:01 字数 316 浏览 4 评论 0原文

我正在我的 OS X 上工作,默认安装了 Apache。 由于某种原因,当我在没有“sudo”的情况下运行“apachectl”命令时,我得到“没有可用的侦听套接字/无法打开日志”。 我猜这是一个许可的事情,所以有人可以帮助我吗? 我正在使用 Apache 2.2。

另外,顺便问一下,Apache 脚本文件(基本上是 linux 执行的“exe”)在哪里? 我正在尝试将我的服务器与 Aptana Studio 集成,它需要 Apache 安装的路径。 我知道在 Windows 中,这将是“C:\path\to\httpd.exe”,但我不知道这在 Linux 中如何工作。

I'm working on my OS X with the default installation of Apache. For some reason, when I run the "apachectl" command without the "sudo" I get "no listening sockets available / unable to open logs." I'm guessing this is a permissioning thing, so can someone help me out? I'm using Apache 2.2.

Also, side question, where the the Apache script file that is basically the "exe" that linux executes? I'm trying to intergrate my server with Aptana Studio, and it requires the path to the Apache install. I know in Windows, this would be "C:\path\to\httpd.exe", but I don't know how this works in linux.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心奴独伤 2024-07-29 00:48:01

您的服务器正在监听 80 端口吗? (通常)只有 root 可以打开 1024 以下的端口。因此需要 sudo< /代码>

正如您所见,很多人想知道如何获取围绕这个。 一种可能的解决方案是在路由器上执行端口转发。 (我假设您位于路由器后面......)。 然后端口 80 上的传入连接可以转发到例如端口 8080。因此,仅在本地需要连接到端口 8080。(可能有更优雅的解决方案......其他人会发布它们。)

Is your server listening on port 80? (Usually) only root is allowed to open ports below 1024. Hence the need for sudo.

As you can see, lots of people wonder how to get around this. One possible solution is to perform port-forwarding on your router. (I'm assuming here that you are behind a router...). Then incoming connections on port 80 can be forwarded to e.g. port 8080. Thus only locally does one need to connect to port 8080. (There may be more elegant solutions... somebody else will post them.)

若能看破又如何 2024-07-29 00:48:01

试试这个

(用php)
$a = shell_exec('sudo -u root -S /etc/init.d/apache2 restart < /home/$user/passfile');

密码应存储在 passfile 中

try this

(with php)
$a = shell_exec('sudo -u root -S /etc/init.d/apache2 restart < /home/$user/passfile');

password should stored in passfile

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文