Prerequisites
Download the latest nginx docker image docker pull nginx:latest Create a directory nginx to store the following related things mkdir -p /home/nginx/www /home/nginx/logs /home/nginx/conf Put our static HTML page in the /home/nginx/www folder; Create a file called nginx.conf under the created /home/nginx/conf folder as follows: user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; Deploy nginx
Command Explanation:
After starting, you can access our HTML page through the domain name, but it’s not over yet. Modify nginx.conf Insert the following content into the nginx.conf file we just created: (Note: do not restart first) server { listen 443 ssl; server_name fightingtop.cn www.fightingtop.cn; root /usr/share/nginx/html; ssl_certificate /ssl/certificate.pem; ssl_certificate_key /ssl/2832429_fightingtop.cn.key; ssl_session_timeout 5m; ssl_session_cache shared:SSL:1m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location / { root /usr/share/nginx/html; index index.html index.htm; } } server { listen 80; server_name fightingtop.cn www.fightingtop.cn; rewrite ^ https://$host$1 permanent; } Copy the two certificate files to the nginx container First enter the nginx container and create an ssl folder in the root directory to store the certificate docker exec -it aa5badebd38a /bin/bash cd / mkdir ssl Start copying certificates
You're done, reboot and you're done! The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: JavaScript to achieve click image flip effect
>>: Web page creation question: Image file path
Better-scroll scrolling principle As a parent con...
Table of contents Initialize the project Writing ...
This article uses an example to describe how to s...
String extraction without delimiters Question Req...
This article uses examples to illustrate the func...
Index condition pushdown (ICP) is introduced in M...
Table of contents Basic Selector Extensions Attri...
This article shares the specific code of Vue+expr...
Record the problems you solve for others. Problem...
1. MySQL rpm package installation # Download the ...
Table of contents 1. Reverse proxy preparation 1....
Table of contents cluster Cluster Details Events ...
Good morning everyone, I haven’t updated my artic...
As shown in the figure: But when viewed under IE6...
This article shares the specific code of Vue.js t...