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

时间:2015-05-18 23:58:50

标签: linux apache httpd.conf centos7

在我的问题被撕裂之前,我已经检查过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.

它说文件根有错误我没看到问题是什么......有什么帮助吗?

2 个答案:

答案 0 :(得分:0)

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

  

httpd [12589]:AH00526:第119行的语法错误   /etc/httpd/conf/h...onf:5 May 19 07:24:29 synapticenhancements   httpd [12589]:DocumentRoot必须是目录May 19 07:24:29

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

答案 1 :(得分:0)

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