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

JavaScript to implement the function of changing avatar

This article shares the specific code of JavaScri...

js realizes the function of clicking to switch cards

This article example shares the specific code of ...

Detailed tutorial on installing Docker on CentOS 8.4

Table of contents Preface: System Requirements: I...

How to control the proportion of Flex child elements on the main axis

background Flex layout achieves alignment and spa...

Docker solution for logging in without root privileges

When you use the docker command for the first tim...

The meaning and calculation method of QPS and TPS of MySQL database

When doing DB benchmark testing, qps and tps are ...

Summary of the use of html meta tags (recommended)

Meta tag function The META tag is a key tag in th...

Installation process of CentOS8 Linux 8.0.1905 (illustration)

As of now, the latest version of CentOS is CentOS...

How to view the network routing table in Ubuntu

What are Routing and Routing Table in Linux? The ...

Grid systems in web design

Formation of the grid system In 1692, the newly c...

Talk about the understanding of CSS attribute margin

1.What is margin? Margin is used to control the sp...

React implements import and export of Excel files

Table of contents Presentation Layer Business Lay...

How to enable slow query log in MySQL

1.1 Introduction By enabling the slow query log, ...

Write a dynamic clock on a web page in HTML

Use HTML to write a dynamic web clock. The code i...