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
Table of contents DATETIME TIMESTAMP How to choos...
Table of contents Introduction to Arrays Array li...
Get daily statistics When doing a project, you ne...
About Nginx, a high-performance, lightweight web ...
Solution to 1449 and 1045 exceptions when connect...
1. Install Oracle There are too many Oracle insta...
Table of contents JSON appears Json structure Jso...
Table of contents Problem Description The general...
CSS CodeCopy content to clipboard .bottomTable{ b...
VC6.0 is indeed too old VC6.0 is a development to...
Table of contents Overview 1. Separation of front...
Usually the pictures uploaded by users need to be...
Preface I have always wanted to know how a SQL st...
All websites, whether official, e-commerce, socia...
The reason is simple: In HTML documents, multiple ...