The apache stop menu item in Backtrack Linux accomplishes one goal which is to stop the Apache web server. The previous article for apache start would have been enough to explain the basics to anyone using Apache on Backtrack Linux but since my goal is to write an article for every menu item and every tool within Backtrack here is the one for apache stop.
apache stop
When the apache stop menu item is clicked it launches a terminal window and issues the “service apache2 stop” command and waits a couple of seconds before automatically closing the terminal window. Below is a picture of the terminal window that appears when apache start is clicked from the Backtrack menu.
It is always a good idea when using Apache on Backtrack to make sure you shut it down when you are not actively using it. As noted in the apache start article when the web server is running it is listening on all interfaces so depending on where the Backtrack server is located other people could be viewing the files you are serving from /var/www. To verify Apache is no longer running use netstat and pf to first make sure there is nothing bound to port 80 any longer and second make sure there are no apache2 processes left running as shown in the below example output.
Verify Apache Has Stopped:
- root@bt:~# netstat -antpu | grep '80 ' | grep LISTEN
- root@bt:~#
- root@bt:~# ps -ef | grep apache2
- root 2210 29272 0 23:50 pts/1 00:00:00 grep --color=auto apache2
- root@bt:~#
Notice the ps command does return a result however the result is the actual grep portion of the command we are using to verify no other apache2 processes are running. Also noted in the apache start article are the numerous ways that Apache can be controlled on Backtrack Linux version 5 release 3. The below example shows 3 different methods to stop Apache from the command line in Backtrack.
CLI Ways To Stop Apache On Backtrack Linux:
- root@bt:~# apache2ctl stop
- httpd (no pid file) not running
- root@bt:~# /etc/init.d/apache2 stop
- * Stopping web server apache2
- ...done.
- root@bt:~# service apache2 stop
- * Stopping web server apache2
- ...done.
- root@bt:~#
Notice the output from apache2ctl which notes that httpd (also known as apache2) is not running. If Apache or HTTPD had been running then there would not have been any output to the terminal window in Backtrack.