Apache2 server won't start in HTB Pwnbox

Hi Everyone. Im in the middle of the HTB - Linux fundamentals course and im stuck on the ‘working with web services’ tab. Im trying to start a apache2 server.

I started doing the sudo apt update and after that the sudo apt install Apache
When I try to run it I get the message apache2 failed to start exit-code … I tried different things to fix this, but im wondering if there is a way to reset the pwnbox. I don’t understand how it can not work, when im using the HTB pwnbox, which resets every time you start it right?

Hope you can help.

Best,
Simon

Hey Simon,

I believe that the VNC aspects of pwnbox mess with apache/apache2’s default configs. For apache2 just do the following on a fresh pwnbox:

sudo apt install apache2 -y

After it installs, change the default listen port:
(I find it easier to do everything while root, so I usually run sudo -i and elevate the shell versus having to type sudo everytime.)

sudo vi /etc/apache2/ports.conf

Look for the Listen 80 line and change it to the desired port number and save.

Then start the server and check the status with:

sudo systemctl start apache2.service
sudo systemctl status apache2.service

Good luck, let me know how it works.
-onthesauce

1 Like

Oh yeah, to diagnose the issue. Just run:

sudo systemctl status apache2.service

Prior to fixing, in the service history you will see that it is unable to bind to port 80.
-onthesauce

1 Like

That makes sense and it worked! Thank you so much :slight_smile: Have been struggling for a long time with this.

Excellent! No problem at all! I definitely know what it is like to struggle, there are more then a few modules to struggle on in the academy haha.
-onthesauce