Most Useful Linux commands to manage Apache Server(HTTPD)
In this tutorial, we will describe the some of the useful command to manage the Apache(HTTPD) web server.
Apache Server Installation
1 2 3 4 |
$ sudo apt install apache2 [On Debian/Ubuntu] $ sudo yum install httpd [On RHEL/CentOS] $ sudo dnf install httpd [On Fedora 22+] $ sudo zypper install apache2 [On openSUSE] |
How to check Apache Version
1 2 3 |
$ sudo httpd -v OR $ sudo apache2 -v |
If you want to display the Apache version number and compile settings, use the -V
1 2 3 |
$ sudo httpd -V OR $ sudo apache2 -V |
Check Apache Configuration Syntax Errors
1 2 3 |
$ sudo httpd -t OR $ sudo apache2ctl -t |
Start Apache Service
1 2 3 4 5 6 7 |
------------ On CentOS/RHEL ------------ $ sudo systemctl start httpd [On Systemd] $ sudo service httpd start [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl start apache2 [On Systemd] $ sudo service apache2 start [On SysVInit] |
View Apache Service Status
1 2 3 4 5 6 7 |
------------ On CentOS/RHEL ------------ $ sudo systemctl status httpd [On Systemd] $ sudo service httpd status [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl status apache2 [On Systemd] $ sudo service apache2 status [On SysVInit] |
Reload Apache Service
1 2 3 4 5 6 7 |
------------ On CentOS/RHEL ------------ $ sudo systemctl reload httpd [On Systemd] $ sudo service httpd reload [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl reload apache2 [On Systemd] $ sudo service apache2 reload [On SysVInit] |
Stop Apache Service
1 2 3 4 5 6 7 |
------------ On CentOS/RHEL ------------ $ sudo systemctl stop httpd [On Systemd] $ sudo service httpd stop [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl stop apache2 [On Systemd] $ sudo service apache2 stop [On SysVInit] |
Show Apache Command Help
1 2 3 4 5 |
$ sudo httpd -h OR $ sudo apache2 -h OR $ systemctl -h apache2 |