Bobcares

Steps to install Nginx wildcard certificate and 3 common failure points

by | Jan 11, 2019

SSL certificates are extremely important for the security of your online business.

But, what if you have multiple subdomains to manage?

There comes wildcard SSL certificates that secure multiple subdomains with a single SSL certificate, which reduces the management time and costs.

At Bobcares, we help server owners secure their web servers and domains with wildcard certificates as part of our Dedicated Support Services for web hosts.

Today, we’ll see how our Support Engineers install Nginx wildcard certificate.

 

Wildcard Certificate in Nginx – A Brief description

Before we move on, let’s get a brief idea of the Nginx wildcard SSL certificate.

A wildcard SSL certificate secures multiple sub domains within the same top level domain.

This usually includes a wildcard notation which consists of an asterisk and period before the domain name.

For example, a wildcard certificate for *.domain.com will protect mail.domain.com, ftp.domain.com, www.domain.com, and so on.

 

 nginx wildcard certificate

Pictorial representation of wildcard SSL

 

 

Wildcard Certificate in Nginx – Steps to install it

Now, let’s see how our Dedicated Support Engineers install wildcard certificate on Nginx.

We can divide it into 4 different steps.

 

1) Generate CSR on Nginx

Firstly, our Support Engineers create the CSR(Certificate Signing Request) and the Private Key on the server.

We usually use the command line option to generate the CSR and the private key.

For example, see the below command.

openssl req –new –newkey rsa:2048 –nodes –keyout (domain).key –out (domain).csr

 

Here, replace domain with the name of the CSR and private key. This command generates a CSR file “domain.csr” and private key file “domain.key“.

Most importantly, we ensure that the domain name given during CSR generation is “*.domain.com” because it’s a wildcard certificate.

 

2) Get the certificate files

The next step is to obtain the SSL certificate files from the provider.

Upon purchase, the certificate provider sends the certificate files to the technical contact. This includes both the primary and intermediate SSL certificates.

Once we have the certificate files, we copy these files to the relevant directories along with the private key. Usually, we place these files in /etc/ssl folder.

 

3) Combine the certificate files

Some of the browsers may consider the connection as unsafe, if there is no valid intermediate certificate. So, proper installation of intermediate certificate is a critical step.

Most of the times, the primary certificate and intermediate certificate will be given as 2 different files.

So, our Hosting Engineers always ensure that the primary certificate is combined with the intermediate certificate.

For example, we combine the primary certificate and the intermediate certificate using the below command.

cat domain.crt domain_intermediate.ca-bundle >> ssl_bundle.crt

4) Edit Nginx Virtualhost file

Finally, we add the files to the Nginx virtual host file and add the virtual host record for SSL port 443.

In addition to that, we turn on SSL and add the path of the SSL certificate and private key files.

ssl on;
ssl_certificate /etc/ssl/ssl_bundle.crt; (or bundle.crt)
ssl_certificate_key /etc/ssl/your_domain_name.key;

 

Most importantly, Nginx service restart is needed to apply these changes and enable the SSL certificate.

[Want to setup Nginx wildcard certificate on your server to encrypt the connections? We can do it for you.]

 

Wildcard Certificate in Nginx – Common failure points

These steps looks pretty simple. But, we’ve seen customers report problems with wildcard certificate in Nginx. Let’s see some common issues and how our Dedicated Support Engineers fix them.

 

1) Order of combining intermediate certificates

The order of concatenating certificate files is really important. If it’s wrongly combined, many browsers will detect the intermediate certificate as broken and display a warning “not trusted“.

So, our Hosting Engineers always take care of the order of the files. The certificate of the domain should be listed first, followed by the CA certificate chain.

 

2) Messed up intermediate certificate

Recently a customer contacted us that after installing the SSL wildcard certificate, he received the following error.

nginx SSL PEM_read_bio:bad end line

 

When we checked, the certificate and key files are all fine. Later, we identified that the problem happened while concatenating the intermediate certificates.

Here, customer forgot to add the below line break while combining the certificate files.

-----END CERTIFICATE----------BEGIN CERTIFICATE-----

 

As a result, Nginx considers this as an invalid certificate file, and throws this error.

In this case, our Hosting Engineers simply add a line break and combine all the certificate files once again, which fixed the issue.

[And, do you need help to resolve this error? Click here! One of our Support Experts will quickly fix it for you.]

 

3) Missing Listen directive

The Listen directive tells the server to accept incoming requests only on the specified port(s) or address-and-port combinations.

The normal SSL port is 443. So, once the SSL certificate is uploaded, it is necessary to add a virtual host for port 443.

However, we’ve seen cases in which where users forgot to add the Listen directive to bind the SSL port 443. As a result, users may receive an error message “site not available” .

In such cases, our Hosting Engineers manually add the Listen directive in the nginx configuration file and restart nginx service to fix the issue.

[Trouble with Nginx wildcard certificate? Don’t panic, one of our Nginx Experts can help you here.]

 

Conclusion

In short, installing Nginx wildcard certificate involves 4 simple steps. But if not properly installed, it can mess up your websites. Today, we’ve discussed how our Dedicated Support Engineers install wildcard certificate in Nginx without breaking the website and the common failure points.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF