您的浏览器过于古老 & 陈旧。为了更好的访问体验, 请 升级你的浏览器
该网名无法显示 发布于2019年06月01日 11:48 最近更新于 2019年06月10日 18:39

Linux环境下如何安全启动httpd?

2176 次浏览 读完需要≈ 1 分钟 Apache

在修改httpd时候重启没成功,有没有虚拟预启动方法?

1 个回答

Ready · 4年前

你在命令行中输入 httpd -help可以得到如下内容输出:

Usage: httpd [-D name] [-d directory] [-f file]
             [-C "directive"] [-c "directive"]
             [-k start|restart|graceful|graceful-stop|stop]
             [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed vhost settings
  -t -D DUMP_RUN_CFG : show parsed run settings
  -S                 : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
  -t -D DUMP_MODULES : show all loaded modules 
  -M                 : a synonym for -t -D DUMP_MODULES
  -t -D DUMP_INCLUDES: show all included configuration files
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check
  -X                 : debug mode (only one worker, do not detach)

其中有一个 -t 选项,就是用来测试 Apache httpd 配置文件的语法是否正确的。

httpd -t [配置文件路径]
# 配置文件路径可以省略,直接就是默认的配置文件路径。

所以,你直接使用httpd -t命令即可。

撰写答案