Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The complete steps of building a local https environment with Docker

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

What is HTTPS?

We all know that Web App runs on the HTTP protocol at the web application layer, which enables requests and returns between clients and servers. However, this process is plaintext transmission, when the request is captured after the transmission content is easily tampered with, which is an extremely serious threat to user security. PWA applications require that the project be deployed in an HTTPS environment for security reasons.

So what is HTTPS?

HTTPS is HTTP over SSL/TLS, the effect of which is to encrypt HTTP traffic, including requested URLs, results pages, cookies, media assets, and other content transmitted over HTTP. People who try to interfere with HTTPS connections cannot listen to traffic or change its content. In addition to encryption, the identity of the remote server needs to be verified: after all, encrypting a connection doesn't make sense if you can't be sure who's on the other end of the connection. These measures will make it extremely difficult to intercept traffic. While it is still possible for an attacker to know which website a user is visiting, that is as far as he can go.

https request flow chart

This article will use Docker & docker-compose to build a local https environment, the following words do not say much, let's take a look at the detailed introduction.

Tools:

acme#sh (generate free certificates) Docker & docker-composeihost (hosts file can be modified manually)

Profile:

docker-compose.dev.yml

version: '3'services: proxy: image: nginx:stable-alpine ports: - 443:443 volumes: - /Users/thonatos/.acme.sh/*.implements.io:/etc/nginx/ssl/ - ./ default.conf:/etc/nginx/conf.d/default.conf

default.conf

# HTTP server#server { listen 443 ssl; server_name szcu.implements.io; ssl_certificate /etc/nginx/ssl/fullchain.cer; ssl_certificate_key /etc/nginx/ssl/*.implements.io.key; location / { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_pass http://192.168.2.51:7001; # IP Please do not use 127.0.0.1}

hosts

127.0.0.1 szcu.implements.io

run

#Start Egg.jsyarn dev#Start nginxdocker-compose -f docker-compose.dev.yml up

Open Chrome and you can see the green lock next to it, done.

summary

The above is the whole content of this article, I hope the content of this article has a certain reference value for everyone's study or work, if you have questions, you can leave a message to exchange, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report