Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I'm trying to get apache to have multiple subdomains, but whenever I try and start apache I'm getting the following error:

(98)Address already in use: make_sock: could not bind to address [::]:80

I tried the following to see if anything was using the port:

root@xxx:/etc/apache2# netstat -ltnp | grep ':80'
root@xxx:/etc/apache2# lsof -i tcp:80
root@xxx:/etc/apache2# 

Note that they both came back with nothing. I'm new to this and I'm assuming I'm doing something blatantly wrong. Here is my 'default' file from sites-available:

Listen 80

<VirtualHost *:80>
    ServerName www.xxx.com
    DocumentRoot /srv/www/xxx.com/site
    ErrorLog /srv/www/xxx.com/logs/error.log
    LogLevel warn
    CustomLog /srv/www/xxx.com/logs/access.log combined
</VirtualHost>
<VirtualHost *:80>
    ServerName aaa.xxx.com
    DocumentRoot /srv/aaa/xxx.com/site
    ErrorLog /srv/aaa/xxx.com/logs/error.log
    LogLevel warn
    CustomLog /srv/aaa/xxx.com/logs/access.log combined
</VirtualHost>

I tried looking through the apache docs and I looked through a few other forums, but it seems everything I found had netstat returning something and were generally for single sites without subdomains.

Any help would be greatly appreciated.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

This looks like a debian-ish system. With that configuration, you don't put listen directives in your vhost files as they are already listed in /etc/apache2/ports.conf. If this system is not a debian-ish system, just grep -R listen /etc/apache2 and find where it's defined.

share|improve this answer
    
So that seemed to work, but I guess I'm lost as to why that would make a difference. Why would putting Listen in the vhosts file make a difference? Isn't apache just picking up each file and 'tailing' them one after another? I assumed any location would work... –  Aram Papazian Jun 3 '13 at 17:11
1  
If you have Listen 80 twice in your config, apache will try to listen on port 80 twice. The second time will fail, as something is already listening on that port (apache itself). –  Dennis Kaarsemaker Jun 3 '13 at 17:13
    
Ahhhhhh gots it. So from the sounds of it you can only have 1 thing listening to a port at any given time? –  Aram Papazian Jun 3 '13 at 17:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.