作者:陈剑冬  历史版本:1  最后编辑:陈剑冬  更新时间:2024-06-12 11:20

1. 物理部署

1.1. 文档地址

Nginx 的物理部署文档如下:

http://doc.bpmhome.cn/docs/ibps_v3_deploy/ibps_v3_deploy-1bkj0hlq8ms5p

2. 容器安装

2.1. 初始化

创建所需的目录及配置文件

# 创建 配置目录
mkdir -p /opt/nginx/conf
# 创建 部署
mkdir -p /opt/nginx/www
# 创建 配置文件
vim /opt/nginx/nginx.conf
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    underscores_in_headers on;

    server {
        listen       80;
        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }
    }
}

2.2. 容器描述文件

# 创建 容器描述文件
vim /opt/nginx/docker-compose.yml
version: '3.3'
service:
  nginx:
    container_name: nginx
    image: nginx:1.27
    restart: on-failure
    ports:
      - 80:80
    volumes:
      - ./conf/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./www:/usr/share/nginx/html

2.3. 启动容器

docker-compose -f /opt/nginx/docker-compose.yml -p nginx up -d