The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: HolyMoly (---.sitbs.at)
Date: February 28, 2023 11:31AM

Hi,

Why is my SSL vhost not working?
The Errormsg I get is "The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port"
But it is defined as a listen port.

The 3 SSL modules are activated, the keys are in place.

this is the vhost.conf

<VirtualHost *:80>
DocumentRoot "c:/wamp64/www/foo"
ServerName www.foo.com
ServerAlias foo.com
<Directory "c:/wamp64/www/foo/">
Require local
</Directory>
</VirtualHost>

<VirtualHost *:443>
ServerName www.foo.com
ServerAlias foo.com


<Location />
Require local
Require ip xxx
Require ip xxx
</Location>

DocumentRoot "c:/wamp64/www/foo"
<Directory "c:/wamp64/www/foo/">
Require all granted
Options +Includes +FollowSymLinks
AllowOverride All
</Directory>

SSLEngine on
SSLCertificateFile "path"
SSLCertificateKeyFile "path"
SSLCertificateChainFile "path"
</VirtualHost>

httpd-ssl.conf
Listen 0.0.0.0:443 https
Listen [::0]:443 https
#Listen 443

httpd.conf
#Listen 0.0.0.0:443
#Listen [::0]:443
Listen 0.0.0.0:80
Listen [::0]:80

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: Otomatic (Moderator)
Date: February 28, 2023 11:50AM

Hi,

For https, the Apache listening port must not only be port 443, but also port 80.
The Apache documentation on this subject specifies that you need both VirtualHost, one on port 80 and the other on port 443.
We can read in the file wamp64/bin/apache/apache2.4.xx/conf/extra/httpd-ssl.conf
# This is the Apache server configuration file providing SSL support.
# When we also provide SSL we have to listen to the
# standard HTTP port and to the HTTPS port
To avoid, as they say in my house, mixing wipes and towels, the VirtualHost port 80 are defined in the httpd-vhosts.conf file and the VirtualHost https port 443 must be defined in the httpd-ssl.conf file like everything else concerning SSL.
There should be nothing concerning SSL in the httpd-vhost.conf file, except for possible https redirection.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: HolyMoly (---.sitbs.at)
Date: February 28, 2023 12:19PM

Hi,

Sorry, I left out the httpd-ssl.conf file.


i read that in the manual and it was the only thing I didn't understand completely.

How do I define a port? It would be really nice if there was a visual example to this statement, for
stupids like me grinning smiley

I tried to delete the virtual host in vhosts and copied it into the ssl.conf but it's the same.

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: HolyMoly (---.sitbs.at)
Date: February 28, 2023 12:22PM

No sorry, my last answer was not correct. I don't get the 443 error, but the page doesn't load. Server error 500

then i get these errors: : AH00072: make_sock: could not bind to address 0.0.0.0:80
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs



Edited 3 time(s). Last edit at 02/28/2023 12:27PM by HolyMoly.

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: Otomatic (Moderator)
Date: February 28, 2023 12:34PM

Hi,

In httpd.conf there must be only :
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
and in httpd-ssl.conf there must be only:
#
# This is the Apache server configuration file providing SSL support.
# When we also provide SSL we have to listen to the
# standard HTTP port and to the HTTPS port
#
Listen 0.0.0.0:443 https
Listen [::0]:443 https

See How to activate https SSL in Wampserver

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: HolyMoly (---.sitbs.at)
Date: February 28, 2023 12:44PM

that is actually the case.

I don't know...

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: HolyMoly (---.sitbs.at)
Date: February 28, 2023 12:48PM

VirtualHost configuration:

Virtual Host: www.foo.com
On port 443 Virtual Host: www.foo.com
*** WARNING: The name of the default server must be 'localhost'

*** WARNING: There is no default server


================== COMPLETE RESULT ==================
VirtualHost configuration:
*:80 www.mysurface.shop (C:/wamp64/bin/apache/apache2.4.54.2/conf/extra/httpd-vhosts.conf:3)
*:443 www.mysurface.shop (C:/wamp64/bin/apache/apache2.4.54.2/conf/extra/httpd-ssl.conf:122)


--- Do you want to copy the results into Clipboard?
--- Press the Y key to confirm - Press ENTER to continue...



Edited 1 time(s). Last edit at 02/28/2023 12:49PM by HolyMoly.

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: HolyMoly (---.sitbs.at)
Date: February 28, 2023 01:52PM

This looks okay so far, right?

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: Otomatic (Moderator)
Date: February 28, 2023 02:12PM

You have deleted the localhost VirtualHost, which you should not have done!


For your information, there is a backup of the httpd.conf and httpd-vhost.conf files that are functional right after installation in the wamp(64)\bin\apache2.4.xx\conf\original\wampserver\ folder

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: HolyMoly (---.sitbs.at)
Date: March 01, 2023 10:03AM

Hey otomatic,

What is the connection between the virtual host in httpd-vhosts and in httpd-ssl?
Why do I get an error if I use the same DocumentRoot?

Options: ReplyQuote
Re: The Port used (443) for the VirtualHost www.mysurface.shop is not a Listen port
Posted by: Otomatic (Moderator)
Date: March 01, 2023 10:17AM

Hi,

> What is the connection between the virtual host in httpd-vhosts and in httpd-ssl?
httpd-vhost.conf -> VirtualHost port 80
httpd-ssl.conf -> VirtualHost port 443 (Without localhost)

I previously gave you a link: How to activate https SSL in Wampserver everything is explained and works perfectly.
To be adapted according to your certificate.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.