Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install a SSL certificate on a Nginx server

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, I would like to share with you how to install the SSL certificate on the Nginx server. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

Install the SSL certificate on the Nginx server to configure nginx

1. Download certificate file

two。 Create a directory cert directory in the conf directory of nginx and copy the certificate file into it.

3. Configure nginx.conf. The complete nginx.conf is as follows:

# user nobody;worker_processes 1 the errorless log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;} http {include mime.types; default_type application/octet-stream # log_format main'$remote_addr-$remote_user [$time_local] "$request" #'$status $body_bytes_sent "$http_referer" #'"$http_user_agent"$http_x_forwarded_for"; # access_log logs/access.log main; sendfile on; # tcp_nopush on; # keepalive_timeout 0; keepalive_timeout 65 # gzip on; server {listen 80; server_name xxx.com;# with your domain name location / {rewrite ^ (. *) $https://xxx.com/$1 permanent;# with your domain name}} server {listen 443; server_name xxx.com;# with your domain name ssl on # set to on to enable the SSL feature. Replace root html; index index.html index.htm; ssl_certificate cert/2946730_www.xxx.com.pem; # with the name of your pem file ssl_certificate_key cert/2946730_www.xxx.com.key; # with the name of your key file ssl_session_timeout 5m; ssl_ciphers ECDHEmuri RSAUASUA128Mustang GCMmuri SHA256 ECDHEV ECDH ghodist aSIGH ghodism null LRV null LRV MD5cond ADHRV RC4 # use this cipher suite. Ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # is configured using this protocol. Ssl_prefer_server_ciphers on; location / {proxy_pass http://localhost:8080/; # request forwarding}

4. Start nginx and access:

Nginx: [emerg] unknown directive ssl error at startup

The reason is that nginx lacks the SSL module, so you need to add the SSL module again, and then start nginx:

Execute the command in the extracted directory (not the installation directory):. / configure-- with-http_ssl_module

Continue with the command: make

Copy the nginx file in the objs directory to / usr/local/nginx/sbin/ to overwrite, and then restart it.

These are all the contents of the article "how to install a SSL certificate on a Nginx server". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report