1

If I use 443 in httpd.conf and want to start the httpd, the error message is:

(98)Address already in use: make_sock: could not bind to address [::]:443
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
Unable to open logs

Actually I don't use 443, I check the port of 443 by:

lsof -i:443

I think the port of 443 is used in ssl.conf, so I can't use it in httpd.conf. When I use 444 or 666 in the httpd.conf, I can start the httpd.

This is the reason?

lxgeek
  • 1,732
  • 2
  • 22
  • 33
  • Exactly. You can refer to the following discussion as explanation: http://stackoverflow.com/questions/1694144/can-two-applications-listen-to-the-same-port – Yury Schkatula Jul 25 '13 at 11:05
  • IF you're already using it in ssl.conf you don't need to use it in httpd.conf. – user207421 Jul 26 '13 at 00:59

1 Answers1

0

Without looking a closer look, yes, that looks like the reason. In the conf.d dir, the default setup is to load all files that end in .conf. ssl.conf sets some universal settings, and then defines a vhost on port 443.

my suggestion is: copy the ssl.conf to ssl.conf.bk (or whatever, just so you have the original for reference) Then edit the vhost in ssl.conf to suit your needs.

ps: Let me back up and explain the conf.d dir just a little in case some reader is confused. Many projects, (not just Apache) use these dirs as a way to have a modular configuration file setup. An admin can just drop a conf file in the correct dir, and apache loads it the next time the service reloads. I use a configuration manager that drops the correct files on the correct servers for me, making it real easy to spin up more servers as needed.

pps: Let me back up again and explain a vhost (aka 'virtualhost'). the Apache project has made their web server flexible enough to host multiple domains. Stick with me here. I can put an apache server on the internet, and point dns records for both www.foo.com and www.bar.com at my IP address, and apache is smart enough to produce different web pages for each. This is what the vhosts are for. the thing is that you are not doing that. Each vhost is a combination of a host name, and a port. the default vhosts are defined like this:

<VirtualHost _default_:443>

or

<VirtualHost *:443>

and these are catch-alls. So if you want http traffic, use the vhost you already have in httpd.conf, or if you want https traffic, use the one in ssl.conf. No need to get fancy if you are trying to just get'r done.

And good luck!

Art Hill
  • 46
  • 5