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
Table of contents question: 1. Enable remote logi...
When using Animation.css, I found that the font o...
HTML stands for Hypertext Markup Language. Nowada...
Table of contents webpack5 Official Start Buildin...
01. Command Overview dirname - strip non-director...
Achieve results Implementation Code <h1>123...
Virtual machines are very convenient testing soft...
0x0 Parameter verification Most of the parameter ...
1. Install mutt sudo apt-get install mutt 2. Inst...
Table of contents 1. Introduction 2. Install Dock...
illustrate When you install the system yourself, ...
For a website, usability refers to whether users c...
Carousel animation can improve the appearance and...
The differences among execute, executeUpdate, and...
The previous article introduced the implementatio...