Apache 是世界使用排名第一的 Web 服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的 Web 服务器端软件之一。它快速、可靠并且可通过简单的 API 扩充,将 Perl/Python 等解释器编译到服务器中。同时 Apache 音译为阿帕奇,是北美印第安人的一个部落,叫阿帕奇族,在美国的西南部。也是一个基金会的名称、一种武装直升机等等. 百度百科 Apache
# 查看Apache服务状态时,显示 Could not reliably determine the server's fully qualified domain name [root@41d129b3de9a ~]# /bin/systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: active (running) since Fri 2020-04-10 11:28:31 UTC; 3s ago Docs: man:httpd(8) man:apachectl(8) Process: 13192 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS) Main PID: 13199 (httpd) Status: "Processing requests..." CGroup: /docker/41d129b3de9ac86439cf7cf46d42d061b26ab31c138520d2090f9d5a9b1f0757/system.slice/httpd.service ├─13199 /usr/sbin/httpd -DFOREGROUND ├─13200 /usr/sbin/httpd -DFOREGROUND ├─13201 /usr/sbin/httpd -DFOREGROUND ├─13202 /usr/sbin/httpd -DFOREGROUND ├─13203 /usr/sbin/httpd -DFOREGROUND └─13204 /usr/sbin/httpd -DFOREGROUND ‣ 13199 /usr/sbin/httpd -DFOREGROUND
Apr 10 11:28:31 41d129b3de9a systemd[1]: Starting The Apache HTTP Server... Apr 10 11:28:31 41d129b3de9a httpd[13199]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.18.0.86. Set the 'Ser...his message Apr 10 11:28:31 41d129b3de9a systemd[1]: Started The Apache HTTP Server. Hint: Some lines were ellipsized, use -l to show in full.
# 解决方法 vi /etc/httpd/conf/httpd.conf 加入一句 ServerName localhost:80
Apache 测试页面
Apache 测试页意味着:
Apache 测试页,意味着您的服务器已正确配置并可以使用。从技术上讲,此页面是首次安装 Apache Web 服务器时的默认索引页面。
那么如何使 Apache 测试页消失呢:
只需打开/var/www/index.html 文件并对其进行修改或删除文件(尽管它可能会触发新的错误)。在 Red Hat Enterprise Linux/CentOS/Fedora Core 下,重命名或删除文件/etc/httpd/conf.d/welcome.conf 以确保您没有看到 Apache 测试页。
Apache has not been designed to serve pages while running as root
问题说明:
root 用户下无法启动 httpd 服务
日志信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
[root@cf8d90d17e9a ~]# systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Mon 2019-12-16 02:06:58 UTC; 25s ago Docs: man:httpd(8) man:apachectl(8) Process: 9553 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE) Process: 9552 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 9552 (code=exited, status=1/FAILURE)
Dec 16 02:06:58 cf8d90d17e9a systemd[1]: Starting The Apache HTTP Server... Dec 16 02:06:58 cf8d90d17e9a httpd[9552]: AH00526: Syntax error on line 1 of /etc/httpd/conf.d/fdm.conf: Dec 16 02:06:58 cf8d90d17e9a httpd[9552]: Error:\tApache has not been designed to serve pages while\n\trunning as root. There are known ... Dec 16 02:06:58 cf8d90d17e9a systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE Dec 16 02:06:58 cf8d90d17e9a kill[9553]: kill: cannot find process "" Dec 16 02:06:58 cf8d90d17e9a systemd[1]: httpd.service: control process exited, code=exited status=1 Dec 16 02:06:58 cf8d90d17e9a systemd[1]: Failed to start The Apache HTTP Server. Dec 16 02:06:58 cf8d90d17e9a systemd[1]: Unit httpd.service entered failed state. Dec 16 02:06:58 cf8d90d17e9a systemd[1]: httpd.service failed.
解决方法:
用于 /etc/httpd/conf.d/fdm.conf 配置中 User 和 Group 不能为root,修改为其他用户即可
1 2 3 4 5 6 7 8 9 10
User fdm Group fdm <VirtualHost *:80> DocumentRoot /home/fdm/web/fdm <Directory /home/fdm/web/fdm> options Indexes MultiViews AllowOverride all Allow from all </Directory> </VirtualHost>
Forbidden You don’t have permission to access xxx.html
[root@6431285efdee conf.d]# /bin/systemctl restart httpd.service Failed to restart httpd.service: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms) See system logs and 'systemctl status httpd.service'for details.
[root@6431285efdee conf.d]# systemctl status httpd.service Failed to get properties: Connection timed out