Complete steps to upgrade Nginx http to https

Complete steps to upgrade Nginx http to https

The difference between http and https is

For some websites, when http is opened, the page prompts that it is not safe. For example, if you click on the website below [it is actually the same website]

http://www.511easy.com/bug/login

http://www.88bugs.com/bug/login

How can I remove this unsafe prompt? Upgrade from http to https

Take a look at the final effect:

If you currently have a website, how do you upgrade it to https?

Domain name: 511easy.com

If you have a domain name, you can apply for a free SSL certificate. As shown in the following screenshot, based on the certificates of various web servers, I use Nginx here.

Then you need to configure nginx.conf, probably use the third one below, the first two are what I use to save.

Compared with http, https is more secure, but not necessarily. Use jmeter/charles/wireshark/fiddle to generate a certificate, and you can easily capture packets on https websites. I can capture packets on most websites and apps.

 upstream tomcatserver1 {
  server 127.0.0.1:8083;
  }
 upstream tomcatserver2 {
  server 127.0.0.1:8085;
  }
   
   
   
server {
  listen 80;
  server_name 511easy.com;
 
 
  location / {
   proxy_pass http://tomcatserver1;
   index index.html index.htm;
  } 
 }
server {
  listen 80;
  server_name 511easy.com;
 
  location / {
   proxy_pass http://tomcatserver2;
   index index.html index.htm;
  }  
 }
worker_processes 1;
 
events {
 worker_connections 1024;
}
 
 
http {
 include mime.types;
 default_type application/octet-stream;
 
 sendfile on;
 
 keepalive_timeout 65;
 
 server {
  listen 80;
  server_name 88bugs;
  location / {
   proxy_pass http://localhost:8083;
  }
  }
 
 server {
  listen 80;
  server_name jenkins;
  location / {
   proxy_pass http://localhost:8080;
  }
  }
}
worker_processes 1;
 
events {
 worker_connections 1024;
}
 
 
http {
 include mime.types;
 default_type application/octet-stream;
 
 sendfile on;
 
 keepalive_timeout 65;
 
 
  server {
  listen 443 ssl;
  server_name www.511easy.com;
  
  ssl on;
  ssl_certificate 1_511easy.com_bundle.crt;
  ssl_certificate_key 2_511easy.com.key;
  ssl_session_timeout 5m;
   
  location / {
   proxy_pass http://localhost:8083;
  }
 
  }
}

Let’s consolidate the meanings of these abbreviations.

HTTP --- Hyper Text Transfer Protocol, Hypertext Transfer Protocol, is a stateless connection built on TCP. The basic workflow is that the client sends an HTTP request

HTTPS ---- Hyper Text Transfer Protocol over Secure Socket Layer or Hypertext Transfer Protocol Secure

The full name is: Hypertext Transfer Protocol Secure, which can be simply understood as the HTTP protocol using SSL encrypted transmission

The default port for HTTP is 80 and the default port for HTTPS is 443
SSL is a security protocol that provides security and data integrity for network communications.

Why Use HTTPS

To protect the security of information transmission and data integrity. It makes visitors feel that the website is trustworthy. For the domestic network environment, it can also prevent broadband operators from forcing advertisements on the website.

If you want to use two ports on a server and use different domain names to execute different ports, Nginx can be configured like this

worker_processes 1;
 
events {
 worker_connections 1024;
}
 
 
http {
 include mime.types;
 default_type application/octet-stream;
 
 sendfile on;
 
 keepalive_timeout 65;
 
 
  server {
  listen 443 ssl;
  server_name www.88bugs.com;
  
  ssl_certificate 1_88bugs.com_bundle.crt;
  ssl_certificate_key 2_88bugs.com.key;
  ssl_session_timeout 5m;
   
  location / {
   proxy_pass http://localhost:8083;
  }
  }
  
  server {
  listen 443 ssl;
  server_name www.511easy.com;
  
  ssl_certificate 1_511easy.com_bundle.crt;
  ssl_certificate_key 2_511easy.com.key;
  ssl_session_timeout 5m;
   
  location / {
   proxy_pass http://localhost:8085;
  }
  } 
}

https://www.88bugs.com/bug/login

https://www.511easy.com/ [Currently modified to point to another port project]

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Example code for using Nginx to implement 301 redirect to https root domain name
  • Nginx domain name SSL certificate configuration (website http upgraded to https)
  • Springboot single architecture http request conversion https request to support WeChat applet calling interface
  • How does the Spring Boot project support both HTTP and HTTPS protocols?
  • How to configure SSL certificate in nginx to implement https service
  • Detailed explanation of the pitfalls of passing HttpServletRequest parameters to asynchronous threads under the Spring framework
  • Nexus uses nginx proxy to support HTTPS protocol

<<:  Let's talk about what JavaScript's URL object is

>>:  How to start multiple MySQL instances in CentOS 7.0 (mysql-5.7.21)

Recommend

How to modify the location of data files in CentOS6.7 mysql5.6.33

Problem: The partition where MySQL stores data fi...

Implementing image fragmentation loading function based on HTML code

Today we will implement a fragmented image loadin...

Linux type version memory disk query command introduction

1. First, let’s have a general introduction to th...

JavaScript to implement login slider verification

This article example shares the specific code of ...

Beginner's guide to building a website ⑥: Detailed usage of FlashFXP

Today I will introduce the most basic functions of...

Summary of important mysql log files

Author: Ding Yi Source: https://chengxuzhixin.com...

Detailed explanation on how to get the IP address of a docker container

1. After entering the container cat /etc/hosts It...

Use jQuery to fix the invalid page anchor point problem under iframe

The application scenario is: the iframe page has n...

More elegant processing of dates in JavaScript based on Day.js

Table of contents Why use day.js Moment.js Day.js...

Analysis of Mysql data migration methods and tools

This article mainly introduces the analysis of My...

Realize map aggregation and scattering effects based on vue+openlayer

Table of contents Preface: Result: 1. Polymerizat...

Tips for viewing History records and adding timestamps in Linux

Tips for viewing History records and adding times...