question:
Error analysis:
Correct operation method:Create a file mkdir -p /mydata/nginx/conf touch /mydata/nginx/conf/nginx.conf vim /mydata/nginx/conf/nginx.conf Write the official initial content in nginx.conf #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } Then run docker run \ -p 80:80 \ --name nginx \ -d --restart=always \ -v /mydata/nginx/html:/usr/share/nginx/html \ -v /mydata/nginx/conf.d:/etc/nginx/conf.d \ -v /mydata/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \ -v /mydata/nginx/logs:/var/log/nginx \ nginx test:
Reference blog: https://www.cnblogs.com/ivictor/p/4834864.html (Summary of directory mounting) https://blog.csdn.net/qierkang/article/details/92657302 https://my.oschina.net/u/3375733/blog/1591091 (If you need to add /conf.d/*.conf, you can read this blog) https://blog.csdn.net/weixin_44757670/article/details/104993869 (If you need to add /conf.d/*.conf, you can read this blog) This is the end of this article about installing Nginx with Docker (including error analysis). For more information about installing Nginx with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Example of using CSS3 to achieve shiny font effect when unlocking an Apple phone
>>: Advantages of INSERT INTO SET in MySQL
1. Built-in functions 1. Mathematical functions r...
Table of contents What utilities does VueUse have...
In MySQL, create a view on two or more base table...
Table of contents 1. Concurrent access control 2....
Table of contents Effect display Component Settin...
Recently a friend asked me if I have ever played ...
The article mainly records the simple installatio...
System environment: Windows 7 1. Install Docker D...
Table of contents 1. Scenario 2. Solution 3. Conc...
Table of contents 1. Use of arrow functions 1. Fr...
1. Use the speed control function to control the ...
This article example shares the specific code of ...
Method 1: Please add the following code after <...
Table of contents Introduction to utf8mb4 UTF8 by...
Solve the problem that the vue project can be pac...