Linux command
apache 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Start Apache
apachectl start
Stop Apache
apachectl graceful-stop
Gracefully restart
apachectl graceful
Test configuration
apachectl configtest
Show Apache version
apachectl -v
Show compiled-in modules
apachectl -l
Show all loaded modules
apachectl -M
Show parsed virtual host settings
apachectl -S
说明
Apache HTTP Server (httpd) is one of the most widely used web server software packages. It serves static and dynamic content over HTTP/HTTPS, supporting virtual hosting, URL rewriting, authentication, and extensive module-based extensibility. The apachectl script provides a convenient interface for controlling the Apache daemon. It can operate as a simple front-end to the httpd command, or act as a SysV init script translating one-word arguments like start, restart, and stop into appropriate signals. Configuration is primarily done through httpd.conf and related files. The modular architecture allows enabling features like SSL/TLS (mod_ssl), URL rewriting (mod_rewrite), proxying (mod_proxy), and dynamic content via CGI, PHP, or mod_wsgi. Apache supports multiple Multi-Processing Modules: prefork (process-based) for compatibility, worker (threaded), and event (threaded with improved keep-alive handling) for higher concurrency.
参数
- start
- Start the Apache httpd daemon.
- stop
- Stop the daemon immediately.
- restart
- Restart the daemon (aborts current connections).
- graceful
- Gracefully restart (finish current requests, then restart).
- graceful-stop
- Gracefully stop (finish current requests, then stop).
- configtest
- Check configuration file syntax.
- fullstatus
- Display full server status (requires mod_status and a text-based browser).
- -v
- Show version number.
- -V
- Show version and build parameters.
- -l
- List compiled-in modules.
- -M
- List all loaded modules (static and shared).
- -t
- Test configuration syntax (same as configtest).
- -S
- Show parsed virtual host settings.
- -f _file_
- Specify an alternate configuration file.
- -D _name_
- Define a parameter for use in configuration conditionals.
FAQ
What is the apache command used for?
Apache HTTP Server (httpd) is one of the most widely used web server software packages. It serves static and dynamic content over HTTP/HTTPS, supporting virtual hosting, URL rewriting, authentication, and extensive module-based extensibility. The apachectl script provides a convenient interface for controlling the Apache daemon. It can operate as a simple front-end to the httpd command, or act as a SysV init script translating one-word arguments like start, restart, and stop into appropriate signals. Configuration is primarily done through httpd.conf and related files. The modular architecture allows enabling features like SSL/TLS (mod_ssl), URL rewriting (mod_rewrite), proxying (mod_proxy), and dynamic content via CGI, PHP, or mod_wsgi. Apache supports multiple Multi-Processing Modules: prefork (process-based) for compatibility, worker (threaded), and event (threaded with improved keep-alive handling) for higher concurrency.
How do I run a basic apache example?
Run `apachectl start` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does start do in apache?
Start the Apache httpd daemon.