AH00558:httpd:创建VirtualHost后无法可靠地确定服务器的标准服务器名称错误

问题描述 投票:0回答:1

我已经在CentOS 8中安装了Apache服务器,并且可以正确地服务于http和https页面,也就是说,当从浏览器连接到服务器时,我可以查看Apache测试页面。>

我使用本教程启用https:https://www.techrepublic.com/article/how-to-enable-https-on-apache-centos/

非常有效。但是,当我尝试使服务器能够提供除默认测试页以外的其他网页时,尝试使用]重新启动apache服务器时,出现错误“ AH00558:httpd:创建VirtualHost后无法可靠地确定服务器的标准服务器名称错误” >

sudo systemctl restart httpd  

这是我的/etc/https/conf/http.conf的内容,其中删除了一些注释。

ServerRoot "/etc/httpd"
Listen 80

Include conf.modules.d/*.conf

User apache
Group apache

ServerAdmin root@localhost

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

</IfModule>

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    TypesConfig /etc/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

AddDefaultCharset UTF-8

<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>

EnableSendfile on

IncludeOptional conf.d/*.conf

IncludeOptional sites-enabled/*.conf

我感觉这与ServerName条目有关。如上所示,默认情况下已对其进行注释,但是我尝试取消注释并与VirtualHost文件中的coonfiguration匹配,但出现了相同的错误。

这是/etc/httpd/sites-available/adorkable.conf的内容

NOTE

:adorkable一词已被beem替换为我的用户名username1)

ServerAdmin [email protected]“ / var / www / html / username1 /”ServerName localhost.localdomainServerAlias用户名1ErrorLog /var/www/html/username1/error.log

DirectoryIndex index.html index.php选项FollowSymLinks允许全部覆盖要求所有授予

在发出systemctl重新启动httpd之后输出systemctl状态httpd:

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2020-05-14 14:53:28 KST; 43s ago
     Docs: man:httpd.service(8)
  Process: 11746 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 11746 (code=exited, status=1/FAILURE)
   Status: "Reading configuration..."

May 14 14:53:28 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
May 14 14:53:28 localhost.localdomain httpd[11746]: 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
May 14 14:53:28 localhost.localdomain systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
May 14 14:53:28 localhost.localdomain systemd[1]: httpd.service: Failed with result 'exit-code'.
May 14 14:53:28 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.

如何在此处重新启动httpd服务?

我已经在CentOS 8中安装了Apache服务器,并且它可以正确地服务于http和https页面,也就是说,当从使用的浏览器连接到服务器时,我可以查看Apache测试页面。 [

请使用以下命令检查Apache httpd语法:

httpd -t

apache httpd.conf centos8
1个回答
0
投票
请使用以下命令检查Apache httpd语法:

httpd -t

© www.soinside.com 2019 - 2024. All rights reserved.