httpd.service 的 sudo apachectl restart 作业失败。有关详细信息,请参阅 'systemctl status httpd.service' 和 'journalctl -xn'

sudo apachectl restart Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details

在我的问题被撕裂之前,我已经检查过 SELinux 是否被禁用并且它是并且 sudo apachectl restart 没有工作。

我 运行 遇到了一个问题让我先说我是一个菜鸟,当我 运行 sudo apachectl restart 它给了我一个错误:

"Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details." 

当我 运行 journalctl -xn 它指出

"no files were found" 

当我 运行 sudo systemctl status httpd.service 我收到了:

"httpd.service - The Apache HTTP Server    Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)    Active: failed (Result: exit-code) since Tue 2015-05-19 07:24:29 SGT; 1min 27s ago   Process: 12590 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)   Process: 12589 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)  Main PID: 12589 (code=exited, status=1/FAILURE) May 19 07:24:29 synapticenhancements httpd[12589]: AH00526: Syntax error on line 119 of /etc/httpd/conf/h...onf: May 19 07:24:29 synapticenhancements httpd[12589]: DocumentRoot must be a directory May 19 07:24:29 synapticenhancements systemd[1]: httpd.service: main process exited, code=exited, status=...LURE May 19 07:24:29 synapticenhancements kill[12590]: kill: cannot find process "" May 19 07:24:29 synapticenhancements systemd[1]: httpd.service: control process exited, code=exited status=1 May 19 07:24:29 synapticenhancements systemd[1]: Failed to start The Apache HTTP Server. May 19 07:24:29 synapticenhancements systemd[1]: Unit httpd.service entered failed state. Hint: Some lines were ellipsized, use -l to show in full.

有什么想法吗?


# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/he/sites"

#
# Relax access to content within /var/www.
#
<Directory "/he/sites">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

# Further relax access to the default document root:
#directoryIndex: sets the file that Apache will serve if a directory
# is requested.

它说文档根有一个错误我不明白问题是什么...有什么帮助吗?

已经告诉您错误的确切位置。您对配置文件进行了更改,但该文件无效或输入错误。它甚至会告诉您它的行号。

httpd[12589]: AH00526: Syntax error on line 119 of /etc/httpd/conf/h...onf: May 19 07:24:29 synapticenhancements httpd[12589]: DocumentRoot must be directory May 19 07:24:29

如果您使用 VIM 编辑文件,您可以 :set number 查看行号以找出您的错误。

已解决: 显然我把我的文件结构放在错误的部分所以我基本上引用了一些不存在的东西。我将文件结构移动到根目录,一切正常。