How to setup www subdomain?

Please fill out the fields below so we can help you better.

My domain is:

I ran this command:
sudo certbot --nginx

It produced this output:
Which names would you like to activate HTTPS for?
1.) domain.com

I miss the option 2) www.domain.com

How can I add the subdoamin www. ?

I tried:
sudo certbot --expand -d domain.com -d www.domain.com
and got:
Certbot doesn’t know how to automatically configure the web server on this system. However, it can still get a certificate for you. Please run “certbot certonly” to do so. You’ll need to manually configure your web server to use the resulting certificate.

tried 1 and 2 with no success.

My web server is (include version):

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

My hosting provider, if applicable, is:

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

How would you like to authenticate with the ACME CA?

1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)

Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel): 1
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c’
to cancel): domain.com, www.domain.com


You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/domain.com.conf)

It contains these names: domain.com

You requested these names for the new certificate: domain.com, www.domain.com.

Do you want to expand and replace this existing certificate with the new
certificate?

(E)xpand/©ancel: e
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for domain.com
tls-sni-01 challenge for www.domain.com
Cleaning up challenges
Problem binding to port 443: Could not bind to IPv4 or IPv6.

Try:
sudo certbot --nginx --expand -d domain.com -d www.domain.com

Show:
netstat -pant

Hi rg305,
my output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for domain.com
tls-sni-01 challenge for www.domain.com
Cleaning up challenges
Cannot find a VirtualHost matching domain www.domain.com.

(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:2368 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:38634 127.0.0.1:3306 ESTABLISHED -
tcp 0 0 127.0.0.1:3306 127.0.0.1:38630 TIME_WAIT -
tcp 0 0 127.0.0.1:3306 127.0.0.1:38620 TIME_WAIT -
tcp 0 0 127.0.0.1:3306 127.0.0.1:38624 TIME_WAIT -
tcp 0 0 127.0.0.1:3306 127.0.0.1:38622 TIME_WAIT -
tcp 0 0 127.0.0.1:3306 127.0.0.1:38626 TIME_WAIT -
tcp 0 0 127.0.0.1:3306 127.0.0.1:38634 ESTABLISHED -
tcp 0 68 172.31.1.100:22 59.45.175.97:51860 ESTABLISHED -
tcp 0 0 127.0.0.1:38636 127.0.0.1:3306 ESTABLISHED -
tcp 0 0 127.0.0.1:3306 127.0.0.1:38636 ESTABLISHED -
tcp 0 604 172.31.1.100:22 31.150.141.xxx:49258 ESTABLISHED -
tcp 0 0 127.0.0.1:3306 127.0.0.1:38632 TIME_WAIT -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -

By the way: its my third server install. by the previous install i could always choose 1) domain.com or/and 2) www.domain.com

What did i wrong? I consider to reset the server and install all new.

I use the email address at the first install, too. is there the problem?
I install ghost blog. And i have to enter the email i use with letsentrypt. Maybe i have mistype something?!

I reinstal all new and had the same problems.
(only option 1) (no www.) try to add www. domain with: sudo certbot --nginx --expand -d domain.com -d www.domain.com

got: Cannot find a VirtualHost matching domain www.domain.com

before i install certbot on my vps i try: www.domain.com / domain.com in my browser and the url auto switch to https

I have no access on my website (http) because its auto swtich to https.

ALL before i use/Install certbot, why? or how?

Mybe it usefull:

I switched the server provider yesterday.

On the old provider all went well.
so setup a new project on providernew (because cheaper)
and now i want to switch the old project from the old provider to the new provider.
cannot add www. url / cannot access website because automativ switch to https (the NOT installed/ configured yet)

I think i solved the problem.
just add www.domain /etc/nginx/sites-available

Now, it works :slight_smile:

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