Problem binding to port 80: Could not bind to IPv4 or IPv6

I have 2 projects running on different ports - 80 and 8005 on the same server. These ports point to example1.com and example2.com respectively. I installed SSL certificate for example1.com using https://tecadmin.net/install-lets-encrypt-create-ssl-ubuntu/ and it worked. However when I tried for example2.com, I got this error - Problem binding to port 80: Could not bind to IPv4 or IPv6.

I am guessing it needs example2.com to be port 80, is there a workaround this? How can I install a SSL certificate for example2.com?

This is how /sites-enabled look like

example1.com-le-ssl.conf example1.com.conf example2.com.conf

example1.com-le-ssl.conf -

<IfModule mod_ssl.c>
<VirtualHost *:443>
     
        ServerName example1.com
        ServerAlias www.example1.com
        ServerAdmin example1@gmail.com
        DocumentRoot /var/www/html/example1/public

        <Directory /var/www/html/example1/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
       </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example1.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example1.com/privkey.pem
</VirtualHost>

</IfModule>

example1.com.conf -

<VirtualHost *:80>
      
        ServerName example1.com
        ServerAlias www.example1.com
        ServerAdmin example1@gmail.com
        DocumentRoot /var/www/html/example1/public

        <Directory /var/www/html/example1/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
       </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

      
RewriteEngine on
RewriteCond %{SERVER_NAME} =example1.com [OR]
RewriteCond %{SERVER_NAME} =www.example1.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

example2.com.conf

<VirtualHost *:80>
        
        ServerName example2.com
        ServerAlias www.example2.com
        #ServerAdmin example2@gmail.com
        DocumentRoot /var/www/html/example2/public

        <Directory /var/www/html/example2/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        </Directory>
</VirtualHost>

<VirtualHost *:8001>
       

        ServerName example2.com
        ServerAlias www.example2.com
        #ServerAdmin example2@gmail.com
        DocumentRoot /var/www/html/example2/public

        <Directory /var/www/html/example2/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

             SSLEngine on
       
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/example2.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example2.com/privkey.pem
</VirtualHost>

My domain is: http://naturalobsessionnigeria.com

I ran this command: sudo certbot-auto certonly --standalone -d naturalobsessionnigeria.com -d www.naturalobsessionnigeria.com

It produced this output: Problem binding to port 80: Could not bind to IPv4 or IPv6.

My web server is (include version): Apache 2

The operating system my web server runs on is (include version): Ubuntu 18.04

My hosting provider, if applicable, is: AWS

I can login to a root shell on my machine (yes or no, or I don’t know): YES

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): 0.31.0

1 Like

Hi @mmuoDev

please share your complete setup:


Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:

I ran this command:

It produced this output:

My web server is (include version):

The operating system my web server runs on is (include version):

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don’t know):

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot):

1 Like

I have done that now

You have created two certificates - https://check-your-website.server-daten.de/?q=naturalobsessionnigeria.com

Issuer not before not after Domain names LE-Duplicate next LE
Let's Encrypt Authority X3 2019-11-13 2020-02-11 naturalobsessionnigeria.com - 1 entries duplicate nr. 1
Let's Encrypt Authority X3 2019-11-13 2020-02-11 www.naturalobsessionnigeria.com - 1 entries duplicate nr. 1

Where are these? Isn't it possible to use these?

Your command

uses --standalone, so a new webserver is startet -> you have to stop your running webserver.

And port 443 answers with a wrong certificate

CN=70shops.com
	23.10.2019
	21.01.2020
expires in 69 days	70shops.com, www.70shops.com - 2 entries

but it's possible this isn't a real problem if you use another port.

1 Like

So what do I do now? Because I am kind of confused now

70shops.com and naturalobsessiionnigeria.com are on the same server but different ports. 70shops.com already had a SSL certificate and now I am trying to do same for .naturalobsessionnigeria.com

I am already using it. See my config file in my question

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.