I'm using Nginx as a caching proxy for ArchLinux mirrors (to speed up internal server builds). It correctly reverse proxies four sites, but returns mysterious 404s on the fifth.
/etc/nginx/conf/nginx.conf:
user http;
worker_processes 2;
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 /var/log/access_log main;
error_log /var/log/error_log debug;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 30;
gzip on;
proxy_buffering on;
proxy_cache_path /srv/http/nginx/proxy levels=1 keys_zone=one:256m inactive=5d max_size=512m;
proxy_buffer_size 4k;
proxy_buffers 100 8k;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_redirect off;
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_cache one;
proxy_cache_key $request_uri;
proxy_cache_valid 200 301 302 30m;
proxy_cache_valid 404 1m;
proxy_cache_valid any 15m;
proxy_cache_use_stale error timeout invalid_header updating;
include /etc/nginx/vhosts/*.conf;
}
/etc/nginx/vhosts/default.conf:
server {
listen 80;
server_name mirror.example.com;
location / {
root html;
index index.html;
}
location /one {
proxy_pass http://www.gtlib.gatech.edu/pub/linux/distributions/archlinux/;
}
location /two {
proxy_pass http://mirrors.xmission.com/archlinux/;
}
location /three {
proxy_pass http://mirror.rit.edu/archlinux/;
}
location /four {
proxy_pass http://lug.mtu.edu/archlinux/ftpfull/;
}
location /five {
proxy_pass http://repo.archlinux.fr/i686/;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
/one
, /two
, /three
, and /four
work flawlessly, but /five
always gives a 404. The site is accessible from the server (verified by copy-pasting into lynx). I cannot figure out why. The only thing in the log file is:
Nov 12 09:49:54 mirror NginxMirror: 10.0.1.91 - - [12/Nov/2010:09:49:54 -0500] "GET /five HTTP/1.1" 404 257 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12" "-"
Any ideas?