Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
# The following variables are substituted into the environment using envsubst.
# This occurs automatically as part of the nginx image startup.
# See: https://github.com/nginxinc/docker-nginx/blob/456bf337ceb922a207651aa7c6077a316c3e368c/entrypoint/20-envsubst-on-templates.sh#L17
# - DJANGO_NGINX_UPSTREAM_URL
# - DJANGO_NGINX_GIT_REVISION
# - DJANGO_NGINX_ENVIRONMENT
error_log /var/log/nginx/error.log;
log_format json_combined escape=json
'{'
'"time_local":"$time_local",'
'"remote_addr":"$remote_addr",'
'"remote_user":"$remote_user",'
'"request":"$request",'
'"status": "$status",'
'"host_header": "$host",'
'"body_bytes_sent":$body_bytes_sent,'
'"request_time":"$request_time",'
'"upstream_response_time":$upstream_response_time,'
'"http_referrer":"$http_referer",'
'"http_user_agent":"$http_user_agent",'
'"http_x_forwarded_for":"$http_x_forwarded_for",'
'"http_authorization":"$http_authorization",'
'"request_id":"$sent_http_x_request_id"'
'}';
access_log /var/log/nginx/access.log json_combined;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
# Compress large responses to save bandwidth and improve latency
gzip on;
gzip_min_length 860;
gzip_vary on;
gzip_proxied expired private auth;
gzip_types application/json text/plain application/javascript;
gzip_disable "MSIE [1-6]\.";
upstream django {
server $DJANGO_NGINX_UPSTREAM_URL;
}
server {
access_log /var/log/nginx/access.log json_combined;
listen 8080;
server_name _;
charset utf-8;
client_max_body_size 75M;
error_page 500 /500.json;
absolute_redirect off;
location /static/ {
alias /app/static/;
}
location / {
include snippets/django_location.conf;
}
location ~ ^/(v1|admin)/ {
include snippets/django_location.conf;
}
location /500.json {
default_type application/json;
return 500 '{"detail": "An internal server error occurred."}';
}
location /terms_of_service.html {
root /var/api/api;
index terms_of_service.html;
}
location /version {
default_type "application/json";
return 200 '{"release": "$DJANGO_NGINX_GIT_REVISION", "environment": "$DJANGO_NGINX_ENVIRONMENT"}';
}
location /favicon.ico {
alias /app/static/favicon.ico;
}
location /favicon.svg {
alias /app/static/favicon.svg;
}
}