user {{ repo_service_user_name }} {{ repo_service_group_name }}; pid /var/run/nginx.pid; {% set _api_threads = ansible_processor_vcpus|default(2) // 2 %} {% set api_threads = _api_threads if _api_threads > 0 else 1 %} worker_processes {{ repo_nginx_threads | default(api_threads) }}; events { worker_connections {{ repo_worker_connections }}; multi_accept on; } http { # Basic Settings include /etc/nginx/mime.types; default_type application/octet-stream; sendfile off; tcp_nopush on; tcp_nodelay on; client_header_timeout 10m; client_body_timeout 10m; send_timeout 10m; proxy_read_timeout 600s; proxy_send_timeout 600s; proxy_connect_timeout 600s; fastcgi_send_timeout 600s; fastcgi_read_timeout 600s; fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=OSGITREPO:100m inactive=60m; fastcgi_cache_key "$scheme$request_method$host$request_uri"; fastcgi_cache_use_stale error timeout invalid_header http_500; fastcgi_ignore_headers Cache-Control Expires Set-Cookie; # Added Larger Post Max client_max_body_size 5M; keepalive_timeout 60 15; types_hash_max_size 2048; # Logging Settings log_format gzip '$remote_addr - $remote_user [$time_local] ' '"$request" $status $bytes_sent ' '"$http_referer" "$http_user_agent" "$gzip_ratio"'; access_log /var/log/{{ repo_service_user_name }}/access.log gzip buffer=32k; error_log /var/log/{{ repo_service_user_name }}/error.log notice; # Gzip Settings gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_min_length 1100; gzip_buffers 16 8k; # Turn on gzip for all content types that should benefit from it. gzip_types application/ecmascript; gzip_types application/javascript; gzip_types application/json; gzip_types application/pdf; gzip_types application/postscript; gzip_types application/x-javascript; gzip_types image/svg+xml; gzip_types text/css; gzip_types text/csv; # "gzip_types text/html" is assumed. gzip_types text/javascript; gzip_types text/plain; gzip_types text/xml; gzip_http_version 1.0; # Path to NGINX Cache fastcgi_cache_path /var/cache/nginx/ levels=1:2 keys_zone=NGINX_CACHE:10m max_size=32m inactive=5m; # Custom Header add_header X-WHOAMI "OpenStack Private Slushee Repository {{ inventory_hostname }}"; # Virtual Host Configs include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; # Map Mobile map $http_user_agent $is_mobile { default 0; ~*android|ip(hone|od)|windows\s+(?:ce|phone) 1; ~*symbian|sonyericsson|samsung|lg|blackberry 1; ~*mobile 1; } }