Forum Moderators: phranque

Message Too Old, No Replies

(13): make sock: could not bind to address [::]:80

virtualhost

         

CaptainCandy

6:35 pm on Mar 25, 2007 (gmt 0)

10+ Year Member



Anyone got any ideas what could throw the following when trying to restart Apache2:-

(13): make_sock: could not bind to address [::]:80

When trying to setup virtual hosting?

jdMorgan

6:55 pm on Mar 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're on a Windows OS, disable or uninstall the IIS server (it's installed by default). It will bind to port 80, making further connections impossible. If you're not on Windows with IIS installed, then I'd guess your previous Apache instance is not shutting down properly, and remains bound to port 80. Perhaps a review of your logs will tell.

Jim

CaptainCandy

7:54 pm on Mar 25, 2007 (gmt 0)

10+ Year Member



Thanks for getting back to me. I am a little desperate on this one. I have been trying to solve this for over a week now. This is a recent fresh install of Ubuntu Server running on an old PII in LAMP configuration. Out of desperation I have just tried replacing all occurrences of port 80 with 8080 in the script yet still I get the same error message. I am new to linux so this is a struggle on all fronts, but I have to say this problem is forcing me to learn more about Linux than I was expecting to.

I have ensured that apache is stopped before running /etc/init.d/apache2 reload
And to my knowledge nothing is sat on port 80

Here is a cat of my script with all 80's replaced with 8080

briansnr@ubuntu:/etc/apache2/sites-available$ cat example
Listen 8080
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerAdmin webmaster@localhost
ServerName www.example.com:8080

DocumentRoot /var/www/example/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/example>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>
briansnr@ubuntu:/etc/apache2/sites-available$

yet still I get:-

briansnr@ubuntu:~$ /etc/init.d/apache2 reload
* Reloading apache 2.0 configuration... httpd not running, trying to start
(13): make_sock: could not bind to address [::]:80
no listening sockets available, shutting down
Unable to open logs

[edited by: jdMorgan at 9:34 pm (utc) on Mar. 25, 2007]
[edit reason] Examplified. [/edit]

DamonHD

8:05 pm on Mar 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1) Take out your URLs, it's against ToS here and may get you some 'interesting' and unwanted visits.

2) You have IPv6 enabled in your conf; is it enabled in your OS?

Rgds

Damon

CaptainCandy

8:13 pm on Mar 25, 2007 (gmt 0)

10+ Year Member



eeeeek! Sorry about the URL's, it won't happen again. Errr.... you got me what is IPv6? And how do I test if it's enabled in my OS? This script is basicly a copy of the default, and amended to my requirments. The script use to be a simple one, but when that wouldn't work I tried this angle.

Thanks for sticking with me on this :)

DamonHD

8:36 pm on Mar 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

IPv6 is the new version of the Internet protocols that everyone will need to switch to in the next 5 to 10 years when the current Net runs out of addresses. I'm *just* starting to enable my sites to handle it.

How you tell if it's enabled will depend on your OS.

Try removing the reference to ::1 which is the IPv6 loopback address, and see if that helps (that's what Apache claims not to be able to bind to).

Rgds

Damon

CaptainCandy

10:21 pm on Mar 25, 2007 (gmt 0)

10+ Year Member



I have reduced the script to read:-

briansnr@ubuntu:/etc/apache2/sites-available$ cat example
NameVirtualHost *
<VirtualHost *>
ServerName www.example.co.uk
DocumentRoot /var/www/example
</VirtualHost>
briansnr@ubuntu:/etc/apache2/sites-available$

Yet still I get

briansnr@ubuntu:/etc/apache2/sites-available$ /etc/init.d/apache2 reload * Reloading apache 2.0 configuration... [Sun Mar 25 23:17:00 2007] [warn] NameVirtualHost *:0 has no VirtualHosts
httpd not running, trying to start
(13): make_sock: could not bind to address [::]:80
no listening sockets available, shutting down
Unable to open logs

ARGGGHHHHHH! This is driving me mad ;(

Please stick with me, I'm sure this is something stupid.

[edited by: jdMorgan at 11:59 pm (utc) on Mar. 25, 2007]
[edit reason] Examplified. See Terms of Service. [/edit]

Glacai

6:25 am on Mar 26, 2007 (gmt 0)

10+ Year Member



Hi,

Try running:

sudo killall apache2
sudo /etc/init.d/apache2 start

Also check that example is enabled, ie. there's a link to it in /etc/apache2/sites-enabled. If not run:

sudo a2ensite

Regards,
Marc

CaptainCandy

7:08 pm on Mar 28, 2007 (gmt 0)

10+ Year Member



Thank's everyone for your input. I have tried everything above and still get the same fail. Fortunatley this is only a recent install and nothing even needs backing-up. So I guess it's time to nuke it, and start again. I will post back here with my findings. Thank's again everyone :)

CaptainCandy

7:14 pm on Mar 28, 2007 (gmt 0)

10+ Year Member



Errrr... just before I nuke. Is there a better option than Ubuntu server? This is an old P3. Pref no GUI. Any recommendations would be realy apreciated.

CaptainCandy

2:24 pm on Mar 31, 2007 (gmt 0)

10+ Year Member



Well nuking the machine helped me realise a few things, that were not obviouse before. I had fumbled where I shouldn't etc. so all the bit's I had broken were put right (what ever they were). I was then able to step by step re-build things using all I had learnt whilst breaking the pre-nuke version. For any other Ubuntu users hitting this problem in the future, these are my findings;

I copied the default file in sites-available


cd /etc/apache2/sites-available
sudo cp default my-site

then edited my copy


sudo vi my-site

To change the top half to read as follows:-

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName my-site.com
ServerAlias *.my-site.com
DocumentRoot /var/www/my-site/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/my-site/>
# Options -Indexes
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
RedirectMatch ^/$ /index.html
</Directory>

Then ran


sudo a2ensite my-site

I found that only by using *:80 not * would work. Wahooo! I had site #1 working. For site #2 I repeated the above, but had to drop the NameVirtualHost *:80 from the top of the file like so;


<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName site-two.com
ServerAlias *.site-two.com
DocumentRoot /var/www/site-two
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/site-two>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
# RedirectMatch ^/$ /apache2-default/
</Directory>

Then


sudo a2ensite site-two

This worked for me. This has been a long and frustraiting journy, but hey I have learnt loads about Linux and especialy vi on the way :)