Syntax format:
httpd [-D name] [-d directory] [-f file]
|shutdown]
[-k install|config|uninstall] [-n service_name]
]
Set the ServerRoot command’s initial value to serverroot. It can be overridden by the ServerRoot directive in the configuration file. Its default value is /usr/local/apache2.
-f config
Use config as the configuration file during startup. If config does not start with "/", it is a path relative to the ServerRoot. Its default value is conf/httpd.conf.
-k start|restart|graceful|stop|graceful-stop
Sends a signal to start, restart or stop httpd.
-C directive
Before reading the configuration file, process the directive's configuration instructions first.
-c directive
After reading the configuration file, process the directive configuration instructions.
-D parameter
Set parameter parameter, which works with the
-e level
When the server starts, set LogLevel to level. It is used to temporarily increase the detail level of error messages at startup to help troubleshoot.
-E file
Send error information during server startup to file file.
-R directory
When the SHARED_CORE rule is used in server compilation, it specifies the directory for shared object files as directory.
-h
Output a brief description of the available command line options.
-l
Output a list of modules statically compiled in the server. It does not list modules dynamically loaded using the LoadModule directive.
-L
Outputs a list of instructions, including the valid parameters and usage area of each instruction.
-M
Outputs a list of enabled modules, including modules statically compiled in the server and modules dynamically loaded as DSOs.
-S
Display the setting results read and parsed from the configuration file (currently only the settings of the virtual host are displayed)
-T
Skip the root file check when starting/restarting (this parameter is in Apache 2.2.17 and its Valid in future versions)
-t
Only perform syntax checking on configuration files. The program exits immediately after the syntax parsing check is completed, or returns "0" (OK), or returns a non-zero value (Error). If "-D DUMP_VHOSTS" is also specified, the details of the virtual host configuration are displayed.
-v
Display the version of httpd and then exit.
-V
Display the versions and compilation parameters of httpd and APR/APR-Util, and then exit.
-X
Run httpd in debug mode. Only one worker process is started and the server is not detached from the console.
The following parameters are only for Windows platforms:
-k install|config|uninstall
Install Apache as a Windows NT service; change the startup method of the Apache service; delete the Apache service.
-n name
Specify the name of the Apache service as name
-w
Keep the console window open so that error messages can be read.
httpd -k install
Register Apache as a windows service. Because we are using the apache2.2 version, the default service name is "Apache2.2".
httpd -k install -n "service name"
Register Apache as a windows service and specify a service name yourself.
httpd -k install -n "service name" -f "confmy.conf"
Register Apache as a windows service, specify a service name yourself, and use a specific configuration file.
httpd -k uninstall
Remove the Apache service. By default, "Apache2.2" will be used.
httpd -k uninstall -n "service name"
Remove the Apache service and create a service name yourself.
httpd -k start
Start the Apache service.
httpd -k stop
Stop the Apache service.
httpd -k restart
Restart the Apache service.