nginx常用配置和nginx镜像验证配置

目的

总结项目中常用的nginx配置,然后通过docker构建一个nginx镜像来快速使用和验证。

目录结构

nginx常用配置和nginx镜像验证配置_第1张图片

nginx配置

nginx.conf文件:

user nginx;
worker_processes auto;

error_log  /var/log/nginx/error.log  notice;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include 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;
    
    keepalive_timeout 75;

    server_tokens off;

    autoindex off;

    charset utf-8;

    # 开启gzip压缩
    gzip on;
    
    ......

详情: nginx常用配置和nginx镜像验证配置

你可能感兴趣的:(nginxdocker)