Backtrack Linux offers a lot to people of all skill sets and I really appreciate the thought that the developers have put behind making this a operating system platform that is friendly to all. In my experience there are penetration testers or information security enthusiasts of all levels and having Backtrack as a platform to learn from is great. The apache start menu item in Backtrack simply starts the Apache web server and is explained in more detail below.
apache start
When the apache start menu item is clicked it launches a terminal window and issues the “service apache2 start” 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.
You can verify Apache is running by using the “ps -ef | grep -i apache” and then you can confirm by either opening a browser on the local Backtrack Linux server and visiting “localhost” or if the server is remote by visiting the IP address of the server in a browser on another computer. It should be noted for people new to Backtrack, web servers, or Apache itself that the default configuration will have Apache listening on all interfaces so once the web server is started and if the server is publicly accessible anyone could visit the IP address of your Backtrack server and access the pages that exist in /var/www.
If there are any issues starting apache you can also verify there is not already another application listening on port 80 by issuing the “netstat -antpu | grep ’80 ‘” command which will display any process that is already bound to port 80 as shown in the below example output.
View Processes Listening To Port 80: Backtrack Linux
- root@bt:~# netstat -antpu | grep '80 ' | grep LISTEN
- tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1399/apache2
- root@bt:~#
The grep ’80 ‘ makes sure to only display port 80 and not port 8000 for instance while the grep LISTEN makes sure to only display processes listening on that port and not inbound connections to the port.
Ways To Control Apache On Backtrack Linux:
There are numerous ways to control the Apache service on Backtrack so some of those methods are listed in the output below.
- root@bt:~# /usr/sbin/apache2ctl
- Usage: /usr/sbin/apache2ctl start|stop|restart|graceful|graceful-stop|configtest|status|fullstatus|help
- /usr/sbin/apache2ctl <apache2 args>
- /usr/sbin/apache2ctl -h (for help on <apache2 args>)
- root@bt:~#
- root@bt:~# /etc/init.d/apache2
- * Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}
- root@bt:~#
- root@bt:~# /usr/sbin/service apache2
- * Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}
- root@bt:~#
- root@bt:~# apache2ctl stop
- root@bt:~# /etc/init.d/apache2 start
- * Starting web server apache2
- ...done.
- root@bt:~# service apache2 reload
- * Reloading web server config apache2
- ...done.
- root@bt:~#
Notice that apache2ctl doesn’t provide any output but it still operates just the same as “service apache2” and “/etc/init.d/apache2”. If there are any actual errors when using apache2ctl they will output to the terminal window.