Permalink
Fetching contributors…
Cannot retrieve contributors at this time
133 lines (103 sloc) 3.45 KB
user nobody nogroup;
worker_processes 1;
error_log /dev/stderr warn;
events {
worker_connections 1024;
}
http {
include mime.types;
log_format main '{'
'"body_bytes_sent":"$body_bytes_sent",'
'"host":"$host",'
'"hostname":"$hostname",'
'"http_forwarded":"$http_forwarded",'
'"http_referer":"$http_referer",'
'"http_user_agent":"$http_user_agent",'
'"http_x_forwarded_for":"$http_x_forwarded_for",'
'"query_string":"$query_string",'
'"remote_addr":"$remote_addr",'
'"remote_user":"$remote_user",'
'"request_method":"$request_method",'
'"request_time":"$request_time",'
'"request":"$request",'
'"scheme":"$scheme",'
'"server_port":"$server_port",'
'"status":"$status",'
'"time_iso8601":"$time_iso8601",'
'"upstream_addr":"$upstream_addr",'
'"upstream_response_time":"$upstream_response_time",'
'"upstream_status":"$upstream_status"'
'}';
access_log /dev/stdout main;
# error_log /dev/stdout debug;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
upstream imagelayers-api {
server imagelayers;
}
upstream badger {
server badger;
}
## health and status check
server {
listen 8080;
location /nginx_status {
stub_status on;
access_log off;
}
}
# used only by clients directly addressing this service
server {
listen 9000;
server_name badge.imagelayers.io;
location / {
access_log /dev/stdout main;
proxy_redirect off;
proxy_set_header Host 'badge.imagelayers.io';
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection 'Keep-Alive';
proxy_pass http://badger/;
}
error_page 404 500 502 503 504 /error.html;
location = /error.html {
root html;
}
}
server {
listen 9000 default_server;
server_name imagelayers.io;
location / {
root /data/dist;
index index.html index.htm;
expires 1h;
add_header Cache-Control "public";
try_files $uri $uri/ /index.html;
}
# forward all requests for /registry to the internal imagelayers-api service
location /registry {
access_log /dev/stdout main;
rewrite /registry/(.*) /registry/$1 break;
proxy_redirect off;
proxy_set_header Host 'imagelayers.io';
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection 'Keep-Alive';
proxy_pass http://imagelayers-api/;
}
# forward all requests for /badge to the internal badge service
location /badge {
access_log /dev/stdout main;
rewrite /badge/(.*) /$1 break;
proxy_redirect off;
proxy_set_header Host 'badge.imagelayers.io';
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection 'Keep-Alive';
proxy_pass http://badger/;
}
error_page 404 500 502 503 504 /error.html;
location = /error.html {
root html;
}
}
}