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;

    server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;

    absolute_redirect off;    #取消绝对路径的重定向
    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location /apaas/ui {

        root   /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri $uri/ /apaas/ui/index.html;
     }
    }

    # 开启gzip
    gzip off;
 
    # 启用gzip压缩的最小文件，小于设置值的文件将不会压缩
    gzip_min_length 1k;
 
    # gzip 压缩级别，1-10，数字越大压缩的越好，也越占用CPU时间，后面会有详细说明
    gzip_comp_level 6;
 
    # 进行压缩的文件类型。javascript有多种形式。其中的值可以在 mime.types 文件中找到。
    # 由于jpg,jpeg,png本来就是压缩格式，再行压缩只会消耗cpu资源，帮助并不大
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/gif;
 
    # 是否在http header中添加Vary: Accept-Encoding，建议开启
    gzip_vary on;
 
    #压缩版本（默认1.1，前端如果是squid2.5请使用1.0）
    gzip_http_version 1.0;
 
    # 禁用IE 6 gzip
    gzip_disable "MSIE [1-6]\.";

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