user mastodon; # changed from 'nginx'
worker_processes auto;
pid /run/nginx.pid;

# compiled brotli modules from https://github.com/google/ngx_brotli
# see: https://github.com/jakejarvis/mastodon-utils/wiki/nginx#brotli-compression
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;

events {
	worker_connections 1024;
}

http {
	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	types_hash_max_size 2048;

	##
	# Logging Settings
	##

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	# https://github.com/doorkeeper-gem/doorkeeper/issues/1554#issuecomment-1304606633
	# proxy_buffers 4 16k;
	# proxy_buffer_size 16k;
	# proxy_busy_buffers_size 32k;

	# stats for prometheus nginx exporter
	server {
		listen 9181;
		location /metrics {
			stub_status on;
			allow 127.0.0.1;
			deny all;
		}
	}

	##
	# Virtual Host Configs
	##

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}
