标签:compose alt keep roc ati str 匹配 worker always
cd /usr/local
进入该目录下,使用 mkdir docker
创建docker目录然后进入。vi docker compose.yml
创建nginxversion: '3.7'
services:
nginx:
restart: always
image: nginx
container_name: nginx
ports:
- 81:80
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./wwwroot:/usr/share/nginx/wwwroot
mkdir conf
创建conf目录并进入。vi nginx.conf
创建nginx.confworker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_header_buffer_size 2k;
server {
listen 80;
server_name 192.168.227.129;
location / {
root /usr/share/nginx/wwwroot/html80;
index index.html index.htm;
}
}
}
docker-compose up -d
以守护态开启nginx.docker ps
查看mkdir html80
创建html80目录,进入该目录,vi index.html
创建index.html页面,写入内容 :Hello Nginx!!标签:compose alt keep roc ati str 匹配 worker always
原文地址:https://www.cnblogs.com/lick468/p/10847877.html