user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
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;

    server {
        server_name cdn-vn.soctrip.com;

        index index.html;

        location / {
            autoindex on;                  # Enables directory listing
            autoindex_exact_size off;      # Shows human-readable file sizes
            autoindex_localtime on;        # Shows the file's local time
            try_files $uri $uri/ =404;     # Tries to serve the requested URI
        }

        root /usr/share/nginx/html;
        listen 80; # managed by Certbot
    }

    server {
        server_name goship.stagingsoctrip.com;

        location / {
            proxy_pass http://10.8.0.92:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

        listen 80;
    }

    include /etc/nginx/conf.d/*.conf;
}

