创建了一个 httpd 服务器,但示例页面未加载

创建了一个 httpd 服务器,但示例页面未加载

我被分配了一台服务器来为我们的服务创建一个测试站点,这是我第一次尝试这样做,所以我做了很多研究,最后我找到了这个它给出了很好的指导,但即使尝试了所有这些,我仍然无法加载我的简单 index.php 页面,我得到的只是一个超时错误页面

我尝试运行调试,但只收到以下警告

httpd -X
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00058: Error retrieving pid file /run/httpd/httpd.pid
AH00059: Remove it before continuing if it is corrupted.

从我读到的所有内容来看,这是一个警告。我更改了 /var/www 文件夹中文件的权限,以便用户可以读取和执行。还有其他方法可以运行调试并找出我的示例页面http://www.example.com/index.php不加载。

我确信问题出在我的服务器设置上,并且我迫切地想要发布帖子。


这是我的 httpd 版本的更新

[@localhost html]$ httpd -v
Server version: Apache/2.4.6 (Red Hat Enterprise Linux)
Server built:   Sep 17 2015 09:06:30

[@localhost /]$ sudo systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2016-03-10 08:47:25 EST; 18min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 5049 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 5047 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS)
 Main PID: 5047 (code=exited, status=0/SUCCESS)

Mar 10 08:47:25 www.example.com systemd[1]: Starting The Apache HTTP Server...
Mar 10 08:47:25 www.example.com httpd[5047]: httpd (pid 4920) already running
Mar 10 08:47:25 www.example.com kill[5049]: kill: cannot find process ""
Mar 10 08:47:25 www.example.com systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 10 08:47:25 www.example.com systemd[1]: Failed to start The Apache HTTP Server.
Mar 10 08:47:25 www.example.com systemd[1]: Unit httpd.service entered failed state.
Mar 10 08:47:25 www.example.com systemd[1]: httpd.service failed.
Mar 10 08:48:27 www.example.com systemd[1]: Stopped The Apache HTTP Server.

这是日志文件

[Thu Mar 10 08:34:05.040127 2016] [mpm_prefork:notice] [pid 4021] AH00169: caught SIGTERM, shutting down
[Thu Mar 10 08:34:08.720785 2016] [core:notice] [pid 4864] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Thu Mar 10 08:34:08.721566 2016] [suexec:notice] [pid 4864] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Mar 10 08:34:08.742757 2016] [auth_digest:notice] [pid 4864] AH01757: generating secret for digest authentication ...
[Thu Mar 10 08:34:08.743567 2016] [lbmethod_heartbeat:notice] [pid 4864] AH02282: No slotmem from mod_heartmonitor
[Thu Mar 10 08:34:08.762688 2016] [mpm_prefork:notice] [pid 4864] AH00163: Apache/2.4.6 (Red Hat Enterprise Linux) PHP/5.4.16 configured -- resuming normal operations
[Thu Mar 10 08:34:08.762712 2016] [core:notice] [pid 4864] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Mar 10 08:42:02.335809 2016] [mpm_prefork:notice] [pid 4864] AH00170: caught SIGWINCH, shutting down gracefully
[Thu Mar 10 08:43:21.804591 2016] [core:notice] [pid 4919] SELinux policy enabled; httpd running as context unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[Thu Mar 10 08:43:21.805328 2016] [suexec:notice] [pid 4919] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Mar 10 08:43:21.827883 2016] [auth_digest:notice] [pid 4920] AH01757: generating secret for digest authentication ...
[Thu Mar 10 08:43:21.828964 2016] [lbmethod_heartbeat:notice] [pid 4920] AH02282: No slotmem from mod_heartmonitor
[Thu Mar 10 08:43:21.849008 2016] [mpm_prefork:notice] [pid 4920] AH00163: Apache/2.4.6 (Red Hat Enterprise Linux) PHP/5.4.16 configured -- resuming normal operations
[Thu Mar 10 08:43:21.849036 2016] [core:notice] [pid 4920] AH00094: Command line: 'httpd'

答案1

经过进一步研究,我发现我的设置是正确的,是防火墙的问题。谢谢大家的帮助!有关更多信息,请查看此页面

https://linuxconfig.org/how-to-stop-start-and-disable-enable-firewall-on-redhat-7-linux-system

相关内容