手机版
你好,游客 登录 注册
背景:
阅读新闻

Apache命令——语法检查

[日期:2012-03-30] 来源:Linux社区  作者:dgd2010 [字体:大 中 小]

Apache configuration files contain one directive per line. The backslash "\" may be used as the last character on a line to indicate that the directive continues onto the next line. There must be no other characters or white space between the backslash and the end of the line.

Directives in the configuration files are case-insensitive, but arguments to directives are often case sensitive. Lines that begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on a line after a configuration directive. Blank lines and white space occurring before a directive are ignored, so you may indent directives for clarity.

You can check your configuration files for syntax errors without starting the server by using apachectl configtest or the -t command line option.

在Apache的配置文件中每一行包含一个指令。反斜杠“\”可能作为下一行的继续标志,指令继续到下一行的最后一个字符。在行的结尾不能有其他字符或空格。在配置文件中的指令是区分大小写的,但往往是大小写敏感的指令参数。每行的开始用散列符“#”作为注释,此行中的所有内容将被忽略。注释不得计入命令行中的配置指令。空行和空格前存在的指令被忽略,所以你可以缩进以标识指令。

你可以使用apachectl configtest 或 -t 命令行选项检查您的配置文件是否存在语法错误。

如下面所示:

  1. [root@localhost ~]# vim /etc/httpd/conf/httpd.conf 
  2. [root@localhost ~]# service httpd restart 
  3. Stopping httpd:                                   [  OK  ] 
  4. Starting httpd:                                   [  OK  ] 
  5. [root@localhost ~]# apachectl configtest 
  6. Syntax OK 
  7. [root@localhost ~]# apachectl -
  8. Syntax OK
  9. [root@localhost ~]#
linux
相关资讯       Apache配置 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款