log_format verbose '$remote_addr\t[$time_local]\t$host\t$request\t$status\t$body_bytes_sent\t$http_referer\t$http_user_agent\t$request_time\t$upstream_response_time';

server {
    server_name go.pkgdoc.org pkgdoc.org www.pkgdoc.org www.godoc.org;
    rewrite ^ http://godoc.org$request_uri? permanent;
}

server {
    server_name talks.godoc.org;
    rewrite ^ http://go-talks.appspot.com$request_uri? permanent;
}

server {
    listen 80 default_server;
    listen 443 ssl default_server;

    ssl_certificate      /ssl/godoc_org.crt;
    ssl_certificate_key  /ssl/godoc_org.key;
    
    server_name _ godoc.org api.godoc.org;
    access_log /var/log/nginx/gddo.log verbose;

    gzip on;
    gzip_proxied any;
    gzip_types text/css text/plain text/javascript application/javascript;

    if ($http_user_agent ~ (seek\.io|Wotbox|Exabot|HTTrack|TurnitinBot|Ezooms|PaperLiBot|Sogou) ) {
        return 444;
    }

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header    Host $http_host;                                                                                                                     
        proxy_set_header    X-Scheme $scheme;
        proxy_set_header    X-Real-IP $remote_addr;
    }
}
