View Full Version : Apache2 bug

July 14th, 2006, 01:27 AM
Hello ,
when i run Apache2 server from the terminal ,i get this :
apache2: Could not determine the server's fully qualified domain name, using for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:80
no listening sockets available, shutting down
Unable to open logs

when i point my browser to it works but why it's not assigned to the localhost (,and what's that issue message .

Many thanks in advance !

July 14th, 2006, 08:51 AM
Running apache2 from the terminal as a normal user will not work.

You'll not be able to user a port below 1024, nor write to the logs, which is the errors you are seeing.

July 14th, 2006, 09:37 PM
Thanks, so i simply run
sudo apache2?

July 14th, 2006, 09:52 PM
sudo /etc/init.d/apache2 start

July 14th, 2006, 09:53 PM
Thanks, so i simply run 'sudo apache2'?
No, you start/stop Apache with the init-script in /etc/init.d/, e.g. '/etc/init.d/apache2 start'. Anyway, this is done by default during boot, you won't have to start it manually.

July 15th, 2006, 05:11 AM
Thanks alot mates!
one more question ,the apache2 server is using instead of ,why?

and how can i know what is reserving the loop-back ip ...

Thanks agian

July 15th, 2006, 05:23 AM
Well, actually, the whole Class C range is the loopback address (that means from all the way to

Anyways, for your error:

apache2: Could not determine the server's fully qualified domain name, using for ServerName
That means that the hostname of your computer couldn't be determined. Firstly, run
sudo nano /etc/hostname and make sure that a hostname is listed there (for example, on my testing server, the hostname is server1.dan-network.local. You can make it anything). Run
sudo hostname --file /etc/hostname to set the hostname.

Next, run
sudo nano /etc/hosts and make sure that there's a line like this: server1.dan-network.local

(replace with the server's IP address, and server1.dan-network.local with the host name you're using).

Finally, restart networking:
/etc/init.d/networking restart. Then, restart Apache2:
/etc/init.d/apache2 restart. Check the error log for any errors:
tail --lines=30 /var/log/apache2/error.log.

Hope this helps you :D

July 21st, 2006, 03:17 AM
Hello, I just tried doing this, running
sudo nano /etc/hostname, changed the address to rick-desktop.local, then tried running the next step, but got this message:

sudo: unable to lookup rick-desktop.local via gethostbyname() In fact, I can't do anything. I tried removing /etc/hostname in order to make a new one, but I can't even do that, getting the same above stated error. Help, please!

July 21st, 2006, 04:24 AM
And I just found out, apt doesn't work now either. Help!

July 21st, 2006, 11:54 AM
And I just found out, apt doesn't work now either. Help!
Sudo can't match your username with the current hostname, so it doesn't allow you to do anything. Can you log in as root? If you reboot in recovery mode, can you then edit the /etc/hosts file to include your hostname? Otherwise, you may need to pop in the Live CD.

July 21st, 2006, 03:54 PM
Well, I kinda cheated and reinstalled the OS. So far all of the errors I had experienced with my first install are now fixed, including this one. But just for future reference how do I boot in recovery mode?


July 21st, 2006, 04:56 PM
And I tried again and get the same error, so yeah, need to boot in recovery mode.

EDIT: I figured out how to login and change the /etc/hostname file back to the original (used Login: Failsafe Terminal -> su root)

Now, my question is this: do I need to do
sudo /etc/init.d/apache2 stop before doing the above steps? Even doing this gives me the error, but will that make the process work without seizing up on me?


July 22nd, 2006, 09:30 AM
The problem is not so much with apache as it is with sudo trying to identify you.

If you want to change your hostname, FIRST change /etc/hosts and add your new hostname (link it to DON'T remove the current hostname from that file yet. After that, you can change your hostname in /etc/hostname. This way, your hostname will always be linked to your internal loopback IP address.

You don't need to restart Apache at all (unless you changed the configuration to use hostnames in stead of IP addresses). If you type in your hostname in the browser, it will connect to (using /etc/hosts) and just connect to Apache the same way it did with the previous hostname.

April 2nd, 2007, 02:53 AM
Easy solution.. give Apache what it wants: FQND (fully qualified domain name.)

What fixed it for me:

Original /etc/hosts entry: themoon

New /etc/hosts entry: themoon themoon.local

restart Apache2, problem solved.