启动/重启 httpd (apache) 时遇到问题

Ric*_*ick 2 httpd centos apache-2.2

我重新启动了我的服务器,现在 httpd 不会重新启动。

我尝试使用命令“service httpd start”,但得到这个响应

[root@mail ~]# sudo service httpd start
Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:8888
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:8888
no listening sockets available, shutting down
Unable to open logs
Run Code Online (Sandbox Code Playgroud)

我以 root 身份登录。我的 ect 目录中没有名为 conf 的目录来查找 conf/httpd.conf ,我的 ect 目录中也没有 init.d/apache2 。我查看了我的 ect/init.d 文件,但没有看到任何关于端口的信息。

我有很多东西要学,但与此同时,我需要重新启动并运行它。谢谢你的帮助。

小智 6

您很可能已启用SELinux并处于“强制”模式。

您可以通过以下方式禁用它:

sudo setenforce 0
Run Code Online (Sandbox Code Playgroud)

然后你可以像往常一样启动apache

sudo service httpd start
Run Code Online (Sandbox Code Playgroud)

如果要永久禁用 SELinux,请编辑/etc/selinux/config并更改SELINUX=enforcingSELINUX=disabled

如果您想继续使用 SELinux,您需要通过添加对端口的访问来修复您的配置,其中包括

sudo semanage port -a -t http_port_t -p tcp 8888
Run Code Online (Sandbox Code Playgroud)