Skip to content

Instantly share code, notes, and snippets.

@sjl
Created April 20, 2011 14:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjl/931501 to your computer and use it in GitHub Desktop.
Save sjl/931501 to your computer and use it in GitHub Desktop.
Firefox
|
V
OS X Laptop port 4565 on OS X Linux VM
Nginx on port 80 -------> is forwarded to 80 on ------> Nginx on port 80
the VM |
V
Gunicorn server
at a socket
OS X - Nginx 1.0.0 =====================================================================
Errors -------------------------------------------------------------
2011/04/20 10:30:42 [error] 15136#0: *1023 writev() failed (32: Broken pipe) while sending request to upstream, client: 127.0.0.1, server: v.v, request: "GET /media/css/style.css HTTP/1.1", upstream: "http://127.0.0.1:4565/media/css/style.css", host: "v.v", referrer: "http://v.v/"
2011/04/20 10:30:42 [error] 15136#0: *967 kevent() reported that connect() failed (54: Connection reset by peer) while connecting to upstream, client: 127.0.0.1, server: v.v, request: "GET /media/images/meg-thumb.jpg HTTP/1.1", upstream: "http://127.0.0.1:4565/media/images/meg-thumb.jpg", host: "v.v", referrer: "http://v.v/"
* Random files get these errors each time, usually between 3 and 5 files out of 32 total requests for a page.
* Both files come down fine over curl.
Main config --------------------------------------------------------
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include /usr/local/etc/nginx/sites-enabled/*;
}
Single Host ---------------------------------------------------------------
upstream backend_vagrant {
server localhost:4565 fail_timeout=0;
}
server {
listen 80;
client_max_body_size 10M;
server_name v.v;
access_log /usr/local/Cellar/nginx/0.7.65/logs/vv.access.log;
error_log /usr/local/Cellar/nginx/0.7.65/logs/vv.error.log;
location / {
proxy_pass http://backend_vagrant;
proxy_redirect off;
proxy_buffering on;
proxy_buffers 8 16k;
proxy_buffer_size 32k;
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-Magic-Header "secret";
client_max_body_size 10m;
}
}
Linux - Nginx 0.7.65 ==========================================================================
No errors anywhere in the logs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment