【问题标题】:Apache on CentosCentos 上的 Apache
【发布时间】:2021-06-10 16:04:19
【问题描述】:

我正在尝试根据this tutorialCentOS 8 设置一个Apache。

教程结束时,我无法重新启动 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 Fri 2021-03-12 16:46:21 CET; 8min ago
      Docs: man:httpd(8)
            man:apachectl(8)
   Process: 8469 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
  Main PID: 8469 (code=exited, status=1/FAILURE)

Mar 12 16:46:21 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Mar 12 16:46:21 localhost.localdomain httpd[8469]: AH00526: Syntax error on line 4 of /etc/httpd/sites-enabled/<>.net.conf:
Mar 12 16:46:21 localhost.localdomain httpd[8469]: Invalid command 'DecumentRoot', perhaps misspelled or defined by a module not included in the server configuration
Mar 12 16:46:21 localhost.localdomain system[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 12 16:46:21 localhost.localdomain system[1]: Failed to start The Apache HTTP Server.
Mar 12 16:46:21 localhost.localdomain system[1]: Unit httpd.service entered failed state.
Mar 12 16:46:21 localhost.localdomain system[1]: httpd.service failed.
[tmaciocha@localhost sites-enabled]$

我能做些什么来强制它启动?

【问题讨论】:

    标签: apache centos


    【解决方案1】:

    您不能强制 Apache 启动,出现该错误;发布你的.conf 文件,也许你有错误

    【讨论】:

      【解决方案2】:

      你是说这个文件吗? /etc/httpd/sites-enabled/domain.net.conf

      enter image description here

      【讨论】:

        【解决方案3】:

        httpd.conf

            # (You will also need to add "ExecCGI" to the "Options" directive.)
            #
            #AddHandler cgi-script .cgi
        
            # For type maps (negotiated resources):
            #AddHandler type-map var
        
            #
            # Filters allow you to process content before it is sent to the client.
            #
            # To parse .shtml files for server-side includes (SSI):
            # (You will also need to add "Includes" to the "Options" directive.)
            #
            AddType text/html .shtml
            AddOutputFilter INCLUDES .shtml
        </IfModule>
        
        #
        # Specify a default charset for all content served; this enables
        # interpretation of all content as UTF-8 by default.  To use the
        # default browser choice (ISO-8859-1), or to allow the META tags
        # in HTML content to override this choice, comment out this
        # directive:
        #
        AddDefaultCharset UTF-8
        
        <IfModule mime_magic_module>
            #
            # The mod_mime_magic module allows the server to use various hints from the
            # contents of the file itself to determine its type.  The MIMEMagicFile
            # directive tells the module where the hint definitions are located.
            #
            MIMEMagicFile conf/magic
        </IfModule>
        
        #
        # Customizable error responses come in three flavors:
        # 1) plain text 2) local redirects 3) external redirects
        #
        # Some examples:
        #ErrorDocument 500 "The server made a boo boo."
        #ErrorDocument 404 /missing.html
        #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
        #ErrorDocument 402 http://www.example.com/subscription_info.html
        #
        
        #
        # EnableMMAP and EnableSendfile: On systems that support it,
        # memory-mapping or the sendfile syscall may be used to deliver
        # files.  This usually improves server performance, but must
        # be turned off when serving from networked-mounted
        # filesystems or if support for these functions is otherwise
        # broken on your system.
        # Defaults if commented: EnableMMAP On, EnableSendfile Off
        #
        #EnableMMAP off
        EnableSendfile on
        
        # Supplemental configuration
        #
        # Load config files in the "/etc/httpd/conf.d" directory, if any.
        IncludeOptional conf.d/*.conf
        IncludeOptional sites-enabled/*.conf
        
        

        【讨论】:

          【解决方案4】:

          一个字母有错误 :) 文档根目录而不是文档根目录

          【讨论】:

            猜你喜欢
            • 2013-03-19
            • 1970-01-01
            • 2017-09-11
            • 2016-01-04
            • 2014-06-13
            • 1970-01-01
            • 2021-12-16
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多