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