|
| 1 | +error_log /dev/stdout info; |
| 2 | +worker_processes 1; |
| 3 | +events { |
| 4 | + worker_connections 1024; # increase if you have lots of clients |
| 5 | + accept_mutex off; # set to 'on' if nginx worker_processes > 1 |
| 6 | +} |
| 7 | + |
| 8 | +http { |
| 9 | + access_log /dev/stdout; |
| 10 | + include mime.types; |
| 11 | + # fallback in case we can't determine a type |
| 12 | + default_type application/octet-stream; |
| 13 | + sendfile on; |
| 14 | + |
| 15 | + # If left at the default of 1024, nginx emits a warning about being unable |
| 16 | + # to build optimal hash types. |
| 17 | + types_hash_max_size 4096; |
| 18 | + |
| 19 | + server { |
| 20 | + # This logic enables us to have multiple servers, and check to see |
| 21 | + # if they are scaled every 10 seconds. |
| 22 | + # https://www.nginx.com/blog/dns-service-discovery-nginx-plus#domain-name-variable |
| 23 | + # https://serverfault.com/a/821625/189494 |
| 24 | + resolver $NAMESERVER valid=10s; |
| 25 | + set $pulp_api pulp_api; |
| 26 | + set $pulp_content pulp_content; |
| 27 | + |
| 28 | + # Gunicorn docs suggest the use of the "deferred" directive on Linux. |
| 29 | + listen 8080 default_server deferred; |
| 30 | + listen [::]:8080 default_server deferred; |
| 31 | + |
| 32 | + # If you have a domain name, this is where to add it |
| 33 | + server_name $hostname; |
| 34 | + |
| 35 | + # The default client_max_body_size is 1m. Clients uploading |
| 36 | + # files larger than this will need to chunk said files. |
| 37 | + client_max_body_size 10m; |
| 38 | + |
| 39 | + # Gunicorn docs suggest this value. |
| 40 | + keepalive_timeout 5; |
| 41 | + |
| 42 | + # static files that can change dynamically, or are needed for TLS |
| 43 | + # purposes are served through the webserver. |
| 44 | + root /opt/app-root/src; |
| 45 | + |
| 46 | + location /pulp/content/ { |
| 47 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 48 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 49 | + proxy_set_header Host $http_host; |
| 50 | + # we don't want nginx trying to do something clever with |
| 51 | + # redirects, we set the Host: header above already. |
| 52 | + proxy_redirect off; |
| 53 | + proxy_pass http://$pulp_content:24816; |
| 54 | + } |
| 55 | + |
| 56 | + location /pulp/api/v3/ { |
| 57 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 58 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 59 | + proxy_set_header Host $http_host; |
| 60 | + # we don't want nginx trying to do something clever with |
| 61 | + # redirects, we set the Host: header above already. |
| 62 | + proxy_redirect off; |
| 63 | + proxy_pass http://$pulp_api:24817; |
| 64 | + } |
| 65 | + |
| 66 | + location /auth/login/ { |
| 67 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 68 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 69 | + proxy_set_header Host $http_host; |
| 70 | + # we don't want nginx trying to do something clever with |
| 71 | + # redirects, we set the Host: header above already. |
| 72 | + proxy_redirect off; |
| 73 | + proxy_pass http://$pulp_api:24817; |
| 74 | + } |
| 75 | + |
| 76 | + include /opt/app-root/etc/nginx.default.d/*.conf; |
| 77 | + |
| 78 | + location / { |
| 79 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 80 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 81 | + proxy_set_header Host $http_host; |
| 82 | + # we don't want nginx trying to do something clever with |
| 83 | + # redirects, we set the Host: header above already. |
| 84 | + proxy_redirect off; |
| 85 | + proxy_pass http://$pulp_api:24817; |
| 86 | + # static files are served through whitenoise - http://whitenoise.evans.io/en/stable/ |
| 87 | + } |
| 88 | + } |
| 89 | +} |
0 commit comments