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

Steps to create a CentOS container through Docker

Table of contents Preface Create a bridge network...

js data types and their judgment method examples

js data types Basic data types: number, string, b...

Example analysis of mysql variable usage [system variables, user variables]

This article uses examples to illustrate the usag...

MySQL 5.7.27 winx64 installation and configuration method graphic tutorial

This article shares the installation and configur...

Detailed explanation of Mysql transaction processing

1. MySQL transaction concept MySQL transactions a...

Some summary of MySQL's fuzzy query like

1. Common usage: (1) Use with % % represents a wi...

A brief talk about cloning JavaScript

Table of contents 1. Shallow cloning 2. Deep clon...

Solution for applying CSS3 transforms to background images

CSS transformations, while cool, have not yet bee...

A detailed introduction to HTML page loading and parsing process

The order in which the browser loads and renders H...

Suggestions on creating business HTML emails

Through permission-based email marketing, not onl...

Vue.js implements the nine-grid image display module

I used Vue.js to make a nine-grid image display m...

Which scenarios in JavaScript cannot use arrow functions

Table of contents 1. Define object methods 2. Def...

Specific usage of CSS compound selectors

Intersection Selector The intersection selector i...