Showing posts with label SSL. Show all posts
Showing posts with label SSL. Show all posts

Thursday, February 15, 2018

[SSL][Resolved] letsencrypt www not working

it's strange that the cert work on non-www but not www.
When I visit the domain with www, I got this problem :

Your connection is not private

Attackers might be trying to steal your information from www.example.com (for example, passwords, messages or credit cards). Learn more
NET::ERR_CERT_COMMON_NAME_INVALID

Help improve Safe Browsing by sending some system information and page content to Google. Privacy Policy
I would like to redirect the www to non-www but not work. Finally I found it related to my A/AAAA record settings: (these IP are fake and for examples)

Hostname     IP Address           TTL
------------------------------------------------------------------------------
                    140.164.10.171                             Default
mail            140.164.10.171                              Default
www           140.164.10.171                             Default
                    2400:8901::f04c:21ff:aee4:f001 Default
mail             2400:8901::f04c:21ff:aee4:f001 Default
www           2400:8901::f04c:21ff:aee4:f001 Default
After I removed the line in red, it works.

If still not work, try to reinstall your domain cert (with www) with certbot such as this command :
sudo certbot --nginx
Example :


What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1

Saturday, May 27, 2017

[SSL][Resolved] Cannot find a VirtualHost matching domain example.com.

Error message

Cannot find a VirtualHost matching domain example.com. In order for Certbot to correctly perform the challenge please add a corresponding server_name directive to your nginx configuration: https://nginx.org/en/docs/http/server_names.html

if you're make sure you have:
1) created sites-available directory 
mkdir /etc/nginx/sites-available
2) Added these 2 lines to your /etc/nginx/nginx.conf
include /etc/nginx/sites-enabled/*.conf;
server_names_hash_bucket_size 64;
Don't forget to create a symbolic link between sites-available and sites-enabled, use the following code:
ln -s /etc/nginx/sites-available/yoursite.com.conf /etc/nginx/sites-enabled/yoursite.com.conf

Reference

https://www.unlimitedwebhosting.co.uk/blog/vps-hosting/setup-nginx-centos-6-vps-server/