3

I just finished coding up a small Go script listening with the Go http package. I wanted to put nginx in front of it (I need to serve static files in a subdir as well), but noticed that req/sec and latency fell dramatically (from 11K req/sec to 1.5K req/sec).

Is there anything wrong with my nginx config? (I'm testing on Mac by the way if that makes a difference)

worker_processes  4;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  65;

    gzip  on;

    include sites/*.conf;
}

And my server config:

server {
    listen       80;
    server_name  go.dev;

    charset utf-8;
    root   /www;

    location /favicon.ico { return 404; }

    location / {
        proxy_pass http://127.0.0.1:8080/;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}
Alfred Xing
  • 133
  • 1
  • 8

0 Answers0