美文网首页
Docker Compose部署Nginx

Docker Compose部署Nginx

作者: LainCheung | 来源:发表于2019-05-07 17:49 被阅读0次

docker-compose.yml配置

version: '3'

services:
  nginx:
    image: nginx:latest
    container_name: nginx
    restart: always
    ports:
      - 80:80
    volumes:
       - ./logs/:/var/log/nginx:rw
       - ./nginx.conf:/etc/nginx/nginx.conf:ro
       - ./vhost/:/etc/nginx/vhost:ro

nginx.conf配置


user nginx nginx;
worker_processes  8;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    use epoll;
    worker_connections  4096;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 64k;
    client_max_body_size 8m;

    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;
    tcp_nodelay on;

    #keepalive_timeout  0;
    keepalive_timeout  300;

    gzip  on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_comp_level 2;
    gzip_types  text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 

    
    include vhost/*.conf;
    
}

相关文章

网友评论

      本文标题:Docker Compose部署Nginx

      本文链接:https://www.haomeiwen.com/subject/azuyoqtx.html