cat nginx.yml

version: '3.1'

services:

  nginx:
    image: nginx:1.16
    restart: always
    environment:
      TZ: Asia/Shanghai
    volumes:
      - /data/nginx/html:/usr/share/nginx/html
      - /data/nginx/conf.d:/etc/nginx/conf.d
      - /data/nginx/nginx.conf:/etc/nginx/nginx.conf
      - /data/nginx/cache:/var/cache/nginx
    ports:
      - "80:80"

准备挂载路径

mkdir /data/nginx/html
mkdir /data/nginx/conf.d
mkdir /data/nginx/cache

准备配置

/data/nginx/nginx.conf


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;
    
}

/data/nginx/conf.d/vbaaswebapp.conf

根据自己环境定义业务需要的配置

/data/nginx/html

将前端代码放在该路径下

启动

docker-compose -f nginx.yml up -d

相关文章:

  • 2021-11-27
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-08-26
  • 2021-09-29
  • 2022-12-23
猜你喜欢
  • 2021-09-22
  • 2021-11-26
  • 2021-07-06
  • 2022-01-03
  • 2021-10-17
  • 2021-07-21
  • 2021-08-09
相关资源
相似解决方案