In this article, We show you how to start/stop and restart Apache 2 web server. Under web server, you can see the different type of operating systems like CentOS, Ubuntu, Debian, RHEL and Fedora, etc. So each and every operating system has a different type of commands to start/stop and rester Apache 2. Apache can be started or restarted using the following methods on Linux or Unix.
Note: You need to run the command as root or via the sudo.
The following commands are works in CentOS and Red Hat for the versions 4/5/6 or older.
class="urvanov-syntax-highlighter-plain-tag"># Start Apache Web Server # service httpd start # Stop Apache Web Server# service httpd stop # Restart Apache Web Server # service httpd restart
The following commands are works in CentOS and Red Hat 7 or newer.
# Start Apache Web Server # systemctl start httpd.service # Stop Apache Web Server # systemctl stop httpd.service # Restart Apache Web Server # systemctl restart httpd.service
You can use service or /etc/init.d/ command to start/stop/restart Apache on Debian and Ubuntu.
sudo service apache2 start
Or
sudo /etc/init.d/apache2 start
Or
/etc/init.d/apache2 start
sudo service apache2 stop
Or
sudo /etc/init.d/apache2 stop
Or
/etc/init.d/apache2 stop
sudo service apache2 restart
Or
sudo /etc/init.d/apache2 restart
Or
/etc/init.d/apache2 restart
The following systemctl command for latest version Debian(8) and Ubuntu(15) or above latest version.
# Start Apache Web Server # systemctl start apache2.service # Stop Apache Web Server # systemctl stop apache2.service # Restart Apache Web Server # systemctl restart apache2.service
The following commands you need to be run as root or sudo user.
# Start Apache Web Server # apachectl -f /path/to/your/httpd.conf apachectl -f /usr/local/apache2/conf/httpd.conf # Stop Apache Web Server # apachectl -k stop # Restart Apache Web Server # apachectl -k restart
The post How to Start/Stop and Restart Apache 2 Web Server appeared first on Linux, Angular, Angular JS, jQuery, PHP, MySQL and Web Development Tutorials.
Kolla Ansible provides production-ready containers (here, Docker) and deployment tools for operating OpenStack clouds. This…
This public beta enables the full Ubuntu Desktop experience on the Qualcomm Dragonwing™ QCS6490 and…
Time is running out to be in full compliance with the EU Cyber Resilience Act,…
Identity management is vitally important in cybersecurity. Every time someone tries to access your networks,…
Welcome to the Ubuntu Weekly Newsletter, Issue 889 for the week of April 20 –…
Introduction I just returned from RubyKaigi 2025, which ran from April 16th to 18th at…