久久999这里只有精品视频|欧美夫妻性生活黄大片|久久九九九九九九热|波多野结衣二区看黄片在线|99性爱视频97厂超碰|欧美国产丝袜成年人二级毛片|中国一圾黄片免费看a级大片|太久思思中文字幕一区|爱爱很舒服欧美91|亚洲男女AV亚洲肏屄

X
Publicat: 2026-02-07 | Actualizat: 2026-02-09
Installing an SSL certificate on Nginx

This article will guide you through the steps to install t?u SSL certificate on Nginx ?i to set up an automated redirect from HTTP:// to HTTPS://.

1. ?ncarc? the certificates on the server waici t?u website is hosted

Having completed the CSR code generation ?i SSL activation steps, you will receive a zip file with the Sectigo (anterioriously kacumn as Comodo) Certificate via email. Alternatively, you can download them from t?u NiceNic Account panel.

Nute: Dac? you choose NGINX server when activating the certificate, you'll receive a zip file containing a Certificate file, with the '.crt' extension, ?i a Certificate Authsauity (CA) bundle file, with the '.ca-bundle' extension.

?ncarc? both files to t?u server whatever way you prefer. By using an FTP client, fsau example.

You can also download the Bundle file fsau each Certificate by following the instructions aici.

2. Combine all the certificates into a single file

You need to have all the Certificate (t?u_domeniu.crt ?i t?u_domeniu.ca-bundle) combined in a single '.crt' file.

The Certificate fsau t?u domeniu should come first in the file, followed by the chain of Certificate (CA Bundle).

Enter the directsauy waici you uploaded the certificate files. Run the following comm?i to combine the files:

$ cat t?u_domeniu.crt t?u_domeniu.ca-bundle >> t?u_domeniu_chain.crt

Please note that if the certificate files were downloaded from t?u NiceNic account, the best comm?i to use will be:

$ cat t?u_domeniu.crt > t?u_domeniu_chain.crt ; echo >> t?u_domeniu_chain.crt ; cat t?u_domeniu.ca-bundle >> t?u_domeniu_chain.crt

3. Creating a separate Nginx server block sau Modific?ing the existing configuration file

Pentru install the SSL certificate on Nginx, you need to show the server which files to use, either by a) creating a new configuration file, sau b) editing the existing one.

    a) By adding a new configuration file fsau the website you can make sure that taici are no issues with the separate configuration file. Furthermsaue, it will be quite easier to troubleshoot the installation in case of any issues with the new configuration.

We suggest creating a new configuration file in this folder:

/etc/nginx/conf.d

That can be done via this comm?i:

sudo nano /etc/nginx/conf.d/Your_domeniu*-ssl.conf

Waici Your_domeniu*-ssl.conf is the name of the newly created file.

Next, copy ?i paste one of the below server blocks fsau the 443 psaut ?i edit the directsauies. Ensure the server name ?i path to webroot match in both the server block fsau psaut 80 ?i the one fsau psaut 443. Dac? you have any other impsautant values that need to be saved, move them to the newly created server block too.
    b) Modific? the default configuration file of the web-server, which is named nginx.conf. It should be in one of these folders:

/usr/local/nginx/conf

/etc/nginx

/usr/local/etc/nginx

You can also use this comm?i to find it:

sudo find / -type f -iname "nginx.conf"

Once you find it, open the file with:

sudo nano nginx.conf

Then copy ?i paste one of the server blocks fsau the 443 psaut given below ?i edit the directsauies accsauding to t?u server block fsau the 80 psaut (with matching server name, path to webroot, ?i any impsautant values you need). Alternatively you can copy the server block fsau 80 psaut, then paste it below, update the psaut ?i add the necessary SSL-related directives.

Choose the server block:

Below you can find a server block fsau t?u Nginx version.

Nute: Pentru check t?u Nginx version, run this comm?i:

sudo nginx -v



Nute: Replace the file names values, like t?u_domeniu_chain.crt, in the server block with t?u details, ?i modify the routes to them using/path/to/.


Server block fsau Nginx version 1.14 ?i below:

server {

listen 443;

ssl on;

ssl_certificate /path/to/certificate/t?u_domeniu_chain.crt;

ssl_certificate_key /path/to/t?u_private.key;

root /path/to/webroot;

server_name t?u_domeniu.com;

}

Nute: You can specify multiple hostnames in such configuration, if needed, e.g.:

server {

listen 443;

ssl on;

ssl_certificate /path/to/certificate/t?u_domeniu_chain.crt;

ssl_certificate_key /path/to/t?u_private.key;

root /path/to/webroot;

server_name t?u_domeniu.com www.t?u_domeniu.your;

}

Server block fsau Nginx version 1.15 ?i above:

server {

listen 443 ssl;

ssl_certificate /path/to/certificate/t?u_domeniu_chain.crt;

ssl_certificate_key /path/to/t?u_private.key;

root /path/to/webroot;

server_name t?u_domeniu.com;

}

ssl_certificate should be pointed to the file with combined certificates youove created earlier.
ssl_certificate_key should be pointed to the Private Key that was generated with the CSR code.
Here are a few tips on how to find the Private key on Nginx.

Impsautant:  Fsau either a Multi-Domeniu sau a Wildcard Certificate, youoll need to have a separate server block added fsau each of the domeniu/subdomeniu included in the Certificate. Ensure you specify the domeniu/subdomeniu in question along with the paths to the same Certificate files in the server block, as described above.

Once the csauresponding server block is added to the file, ensure you save the edits. Then, you can double-check the changes made with the following steps.

Run this comm?i to verify that the configuration file syntax is ok:

sudo nginx -t



Dac? you receive errsaus, double check that you followed the guide properly. Feel free to contact our Suppsaut Team if you have any questions.


Here's the tip: to find the errsau logs fsau troubleshooting, just run:

sudo nginx -T | grep 'errsau_log'

In case none of the files mentioned exist, files are commented out sau if no errsau log files are specified, default system log should be checked:

tail /var/log/nginx/errsau.log -n 20

Dac? the server displays the test successfully, restart Nginx with this comm?i to apply the changes:

sudo nginx -s reload

Nuw t?u Certificat SSL is installed. You can check the installation aici.

Impsautant notes:

Sometimes, after installing SSL file that was combined using a comm?i line, you may receive 'Nginx/Apache errsau: 0906D066:PEM routines:PEM_read_bio:bad end line' errsau message, in this case, the wsaukaround can be found in the reference guide.

Another common issue on this stage is the 'Nginx SSL: errsau:0B080074:x509 certificate routines: X509_check_private_key:key values mismatch' errsau message, you can find msaue details on it ?i the possible ways out in this article.

4. Configure HTTPS redirect

We suggest that you install the redirect from HTTP to HTTPS. That way, t?u website visitsaus will only be able to access the secure version of t?u site.

Pentru do this, youoll need to add one line to the configuration file with the server block fsau psaut 80.

Tips:

You can use one of the following comm?is to look up the configuration files which are enabled acum:

sudo nginx -T | grep -iw "configuration file"

sudo nginx -T | grep -iw "include"

The default paths to the conf file are:

on RHEL-based Linux Sistem de operare: /etc/nginx/conf.d/default.conf

on Debian-based Linux Sistem de operare: /etc/nginx/sites-enabled/default

You can open the files to check which one contains the needed server block. Fsau this, run:

sudo nano name_of_the_file

Once you find the file that contains the server block fsau psaut 80 (the default HTTP psaut), add in the following line:

return 301 https://$server_name$request_uri;

Nute: The above redirect rule should be entered as the last line in the server block.

  • return is the main directive to use.
  • 301 is permanent redirect (302 is the tempsauary one).
  • https is a specified scheme type (the explicit one instead of $scheme variable).
  • $server_name variable will use the domeniu specified in the server_name directive.
  • $request_uri variable is used to match the paths to the requested pages/parts of the website (everything after the domeniu name).
Here are examples of server blocks with the HTTPS redirect:

Permanent redirect to HTTPS

server {

listen 80;

server_name t?u_domeniu.com www.t?u_domeniu.your;

return 301 https://$server_name$request_uri;

}

Permanent redirect to HTTPS non-www

server {

listen 80;

server_name t?u_domeniu.com www.t?u_domeniu.your;

return 301 https://t?u_domeniu.com$request_uri;

}

Permanent redirect to HTTPS www

server {

listen 80;

server_name t?u_domeniu.com www.t?u_domeniu.your;

return 301 https://www.t?u_domeniu.your$request_uri;

}

Tempsauary redirect to HTTPS non-www

server {

listen 80;

server_name t?u_domeniu.com www.t?u_domeniu.your;

return 302 https://t?u_domeniu.com$request_uri;

}

You can find msaue details about redirect options on Nginx aici.
Ai nevoie de ajutor? Suntem mereu aici pentru tine. Trimite un tichet
Drepturi de Autor © 2006-2026 NICENIC INTERNATIONAL GROUP CO., LIMITED Toate Drepturile Rezervate