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

hi. i am also at this part of Working with Web Services. when i do sudo apt update, this happens…

Err:1 Index of /parrot/ rolling InRelease
Cannot initiate the connection to deb.parrot.sh: 443
SNIP

W:Some index files failed to download. THey have been ignored, or old ones used instead.

END

hence, when i do sudo apt install Apache, it gives…
E: Unable to locate package Apache.

can you help me? i am new with HTB and linux in general. thanks

and this recurring message when i did sudo systemctl status apach2.service

Hey! Your status message is a bit cut off, but it looks like it is complaining that the address is already in use. Notice from my post above that in the ports.conf file the line Listen 8080 is added. That is probably set by default to 80 and needs to be changed.

Read my post above about changing the port number in the config. And try those steps. If sudo prompts you for a password check the my_credentials.txt file on the desktop.
-onthesauce

hi. it still wont work

anyway. thanks for the help!

DM me a screenshot of the ports.conf file and I will see if I can help you out!