## 1 I'm learning docker deployment recently, and I initially planned to dockerize nginx. Refer to the official Docker image description for custom configuration After copying the official nginx.conf, I modified and added some customizations, mainly blocking the default.conf and the include folder sites-available # include /etc/nginx/conf.d/.conf; include /etc/nginx/sites-available/; Official original configuration 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; } Create a new docker-compose.yml file and simply specify images, names, ports, and mount local files instead of defaults. version: '3' services: nginx-proxy: image: nginx container_name: nginx ports: -8081:80 volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro ## 2 After running docker-compose up, it keeps getting stuck at attaching to nginx, and the browser cannot access the port address
I don't know where the problem is. After searching for information, I found that I can use the tty parameter for debugging. Modify docker-compose.yml and add a configuration tty:true. docker exec -it nginx /bin/bash I found that after I deleted the default default.conf and did not add any other configuration files, the previous sites-available folder was empty. ## 3 I dug myself up, add -./nginx/sites-available:/etc/nginx/sites-available:ro And add a configuration file in sites-available. /etc/nginx/sites-available# ls default.conf After running, access to the port address is finally normal 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:
|
<<: How to create a child process in nodejs
>>: Linux platform mysql enable remote login
Table of contents sequence 1. Centralized routing...
1. Go to the official website www.mysql.com and s...
Relative path - a directory path established based...
If you use docker search centos in Docker Use doc...
Think about it: Why should css be placed in the h...
What is React React is a simple javascript UI lib...
In the past, float was often used for layout, but...
Ubuntu's own source is from China, so the dow...
Requirements: Remove HTTP response headers in IIS...
Table of contents Steps to create TCP in Linux Se...
Installation environment: CAT /etc/os-release Vie...
This article describes how to build a phalcon env...
This article uses examples to illustrate the func...
This article uses examples to illustrate the diff...
0x00 Introduction A few months ago, I found a vul...