Linux command
apache2 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Start
sudo apache2
Example
sudo apache2 -X
Example
apache2 -t
Example
apache2 -M
Example
apache2 -V
Example
apache2 -S
Example
sudo apache2 -f [/path/to/httpd.conf]
说明
apache2 is the Apache HTTP Server daemon, one of the most widely used web servers. It handles HTTP requests, serves static content, runs CGI scripts, and integrates with application servers through various modules. On Debian/Ubuntu systems, apache2 is typically managed through systemctl or apache2ctl rather than direct invocation.
参数
- -t
- Test configuration file syntax
- -X
- Run in single-process debugging mode
- -M
- List loaded modules (compiled-in and shared)
- -V
- Show version and compile settings
- -f _file_
- Specify configuration file
- -d _directory_
- Server root directory
- -D _name_
- Define parameter for <IfDefine>
- -e _level_
- Startup error log level.
- -k _command_
- Signal command: start, stop, restart, graceful, graceful-stop.
- -S
- Show parsed virtual host settings.
- -l
- List compiled-in modules.
- -L
- List available configuration directives.
- -C _directive_
- Process directive before reading config files.
- -c _directive_
- Process directive after reading config files.
- -h
- Display short summary of command-line options.
FAQ
What is the apache2 command used for?
apache2 is the Apache HTTP Server daemon, one of the most widely used web servers. It handles HTTP requests, serves static content, runs CGI scripts, and integrates with application servers through various modules. On Debian/Ubuntu systems, apache2 is typically managed through systemctl or apache2ctl rather than direct invocation.
How do I run a basic apache2 example?
Run `sudo apache2` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -t do in apache2?
Test configuration file syntax