Node.js Open HTTPS Practice detailed _node.js

Source: Internet
Author: User

First, to go to Tencent Cloud application

Once the application is successful, you will be able to download the certificate directly.

Second, configure Nginx

In the /etc/nginx/conf.d/ next add your domain name configuration such as xxx.com.conf, content as follows

server { 
  listen;
  Listen 443 SSL;
  server_name www.xxx.com;
  SSL_CERTIFICATE/ETC/NGINX/SSL/WWW.XXX.COM_CERT.CRT;
  Ssl_certificate_key/etc/nginx/ssl/www.xxx.com.key;
  Location/{
    proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
    Proxy_set_header Host $http _host;
    Proxy_set_header X-forwarded-proto $scheme;
    Proxy_pass     http://127.0.0.1:8360
  }
}

proxy_passThat is, the reverse proxy to the address of your node service.

sslcertificateAnd the sslcertificate_key need to specify the certificate directory file, that is, the file you downloaded to the /etc/nginx/ssl directory to copy the.

Third, the last restart Nginx can be slightly. Very simple.

Note Switch to HTTPS The trouble is coming, HTTPS does not allow HTTP resource loading requests, so it is a good idea to replace those addresses with support for HTTPS.

Summarize

The above is the entire content of this article, I hope the content of this article for everyone to learn or use Node.js can help, if you have questions you can message exchange.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.