logo

该视频仅会员有权观看

立即开通课程「Node 框架 Express 实践」权限。

¥
199
/ 年

配置 Nginx 服务器支持 HTTPS

  • Obtained an SSL certificate to configure an HTTPS-supporting engine Nginx server.
  • Required SSO config can be found in a code repository; copied config file (ssl_ngx.com) needs to be created on the server in the /etc/letsencrypt directory.
  • Generated a DH prime file using OpenSSL (ssl_dhparam.pem) with a key size of 2048 bits.
  • Edited the Nginx config file to set up two server blocks: one redirects HTTP to HTTPS, and the other listens on port 443 with SSL and HTTP/2 enabled, sets the server name, and includes SSL certificate and key paths.
  • Included additional config file (ssl_engine_x.com) and set DH parameter using the previously generated DH prime file.
  • Set the server's root directory to /mnt/demo.
  • Fixed file permission error by renaming the DH prime file with sudo and confirming Nginx config with no errors.
  • Reloaded Nginx since it had been stopped during certificate application; started it up again to apply the new configuration.
  • Visited the domain in a browser, refreshed the page to see a secure lock icon indicating an HTTPS connection, and verified the SSL certificate's issuer and expiration date.