Stop Apache from Starting on Linux
The procedure to stop Apache from starting at boot time on Linux is as follows:
- Open the terminal application
- Login using ssh for remote server. For example: ssh user@server-name
- Use sudo systemct disable httpd && sudo systemct stop httpd on RHEL/CentOS/Oracle/Fedora Linux.
- Ubuntu/Debian users run sudo systemct disable apache2 && sudo systemct stop apache2 command.
Let us see all commands and examples in details.
Stop Apache on a CentOS/RHEL/Fedora/Oracle Linux from starting
Is Apache 2 service running? Run the following systemctl command:
sudo systemctl status httpdNext find out if httpd enabled at boot time:
sudo systemctl is-enabled httpdIf enabled at boot time, disable it, run:
sudo systemctl disable httpdStop the service, execute:
sudo systemctl stop httpdsudo systemctl mask httpdVerify it:
sudo systemctl status httpdsudo systemctl is-enabled httpdThe mask option will link httpd unit files to /dev/null, making it impossible to start it. This is a stronger version of disable, since it prohibits all kinds of activation of the unit, including enablement and manual activation. Use this option with care. See
Start / Stop and Restart Apache 2 Web Server Command for more info.
A note about Ubuntu/Debian Linux users
The syntax is as follows:
sudo systemctl status apache2sudo systemctl is-enabled apache2sudo systemctl disable apache2sudo systemctl stop apache2sudo systemctl mask apache2You can delete the apache2 server package using the
sudo apt remove apache2I suggest you read man page of systemctl command, type:
man systemctlsystemctl --help
CentOS 6.x and Apache Linux AMI stop Apache from starting
Is httpd server running? Run the following
sudo service httpd statusNext find out if httpd enabled at boot time using the chkconfig command:
sudo chkconfig --list httpdIf httpd is enabled at boot time, disable it, run:
sudo chkconfig httpd offStop the service, execute:
sudo service httpd stopVerify it:
sudo service httpd statussudo chkconfig --list httpdCommands for CentOS 6 or Amazon Linux AMIOne can get more info on service and chkconfig commands:
service --helpchkconfig --helpAnd that is how you disable Apache at boot time on a CentOS 6 or Amazon Linux AMI.
You learned how to stop Apache starting on Linux using various command line options. See Apache 2 home page for
Posted by: Vivek Gite
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via
RSS/XML feed or
weekly email newsletter.
Country Boys Tear Up The Dance Floor With Epic Bluegrass Dance
MoMA The Museum of Modern Art Photo 2018-06-07 19:25
MoMA The Museum of Modern Art
[Artwork details: Julie Mehretu. “Refuge.”