Skip to content

Instantly share code, notes, and snippets.

@gena01
Created September 15, 2016 01:32
Show Gist options
  • Save gena01/b036048ef81a9cda1d088b3cb5476fac to your computer and use it in GitHub Desktop.
Save gena01/b036048ef81a9cda1d088b3cb5476fac to your computer and use it in GitHub Desktop.
nginx openzipkin query reverse proxy
user nginx nginx;
worker_processes 2;
error_log /dev/stderr warn;
pid /var/run/nginx.pid;
daemon off;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /dev/stdout main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_types application/javascript application/json text/css;
server_tokens off;
types {
application/font-woff2 woff2;
}
server {
listen 80;
root /var/www/html;
index index.html;
# Make site accessible from http://set-ip-address.xip.io
server_name localhost;
charset utf-8;
location /api {
expires off;
proxy_pass http://QUERY_PORT_9411_TCP_ADDR:9411;
}
location /traces {
try_files $uri /index.html;
}
location /dependency {
try_files $uri /index.html;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 1d;
add_header Cache-Control "public";
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { access_log off; log_not_found off; }
# Deny .htaccess file access
location ~ /\.ht {
deny all;
}
}
}
#!/bin/sh
#
# Check for required environment variable (simulate openzipkin-web)
#
if [[ -z $QUERY_PORT_9411_TCP_ADDR ]]; then
echo 'You need to set QUERY_PORT_9411_TCP_ADDR environment variable!'
exit 1
fi
echo "QUERY_PORT_9411_TCP_ADDR: $QUERY_PORT_9411_TCP_ADDR"
sed -i "s/QUERY_PORT_9411_TCP_ADDR/$QUERY_PORT_9411_TCP_ADDR/" /etc/nginx/nginx.conf
exec "nginx"
FROM alpine:edge
RUN apk add --update --no-cache nginx curl && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
# Setup services
ADD build/nginx.conf /etc/nginx/nginx.conf
ADD build/run.sh /
EXPOSE 80
# Copy our "app"
COPY html /var/www/html
CMD ["/run.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment