Skip to content
James edited this page Mar 24, 2015 · 5 revisions

Apache

Commands

httpd (apachectl on Debian distribution) is the controller to get informations about version and configuration.

  • httpd -v gives the version, like Server version: Apache/2.4.9 (Win64),
  • httpd -V gives the version, MPM to guess Prefork or whatever, HTTPD_ROOT and SERVER_CONFIG_FILE settings to find the root configuration file,
  • httpd -S gives the existing virtual hosts,
  • httpd -M gives the modules (to check php5, and useful modules),
  • httpd -t checks the syntax.

Root configuration file

If SERVER_CONFIG_FILE begins with a /, it's an absolute path. If not, concatenation of HTTPD_ROOT and SERVER_CONFIG_FILE gives the absolute path of the root configuration file.

On Windows(tm), with Wampserver, HTTPD_ROOT is /apache and does not match the real path.

Configuration files architecture

A shell command like cat SERVER_CONFIG_FILE | sed -e '/^$/d' -e '/^\s*#/d' > server.conf gives all the active lines

A shell command like egrep 'Include' server.conf | sed 's/\s*Include \(.*\)/\1/' gives a list of file and directory patterns to look at. But it doesn't care of <IfDefine>, <IfModule> directives, so ...

Nginx

Commands

nginx is the controller to get informations about version and configuration.

  • nginx -v gives the version, like nginx version: nginx/1.6.2,
  • nginx -V gives then version and conf-path settings to find the root configuration file, like --conf-path=conf/nginx.conf
  • nginx -t checks the syntax.

A shell command like cat conf-path | sed -e '/^$/d' -e '/^\s*#/d' > server.conf gives all the active lines

A shell command like egrep 'include' server.conf | sed 's/\s*include\s+\(.*\)/\1/' gives a list of file and directory patterns to look at.

Others

Soon ...

Implementation with Symfony/Process

Soon ...