Dynamic proxy_pass to $var with nginx 1.0

I’ve recently stumbled upon this need myself and have found that in order to use variables in a proxy_pass destination you need to set a resolver as your error.log would most probably contain something like no resolver defined to resolve … The solution in my case was to setup the following using a local DNS … Read more

Guide on how to use regex in Nginx location block section?

Nginx location: Nginx location block section have a search order, a modifier, an implicit match type and an implicit switch to whether stop the search on match or not. the following array describe it for regex. # ——————————————————————————————————————————————– # Search-Order Modifier Description Match-Type Stops-search-on-match # ——————————————————————————————————————————————– # 1st = The URI must match the specified … Read more

Assigning vhosts to Docker ports

This answer might be a bit late, but what you need is an automatic reverse proxy. I have used two solutions for that: jwilder/nginx-proxy Traefik With time, my preference is to use Traefik. Mostly because it is well documented and maintained, and comes with more features (load balancing with different strategies and priorities, healthchecks, circuit … Read more

django : Serving static files through nginx

I think using root in location block is incorrect. I use alias and it works fine, even without re-configuring django. # django settings.py MEDIA_URL = ‘/static/’ # nginx server config server { … location /static { autoindex on; alias /opt/aa/webroot/; } } Hope this makes things simpler.

110: Connection timed out (Nginx/Gunicorn)

You could try upgrading the timeout for your proxy pass in Nginx by adding: proxy_connect_timeout 75s; proxy_read_timeout 300s; on /var/nginx/sites-available/[site-config] or /var/nginx/nginx.conf if you want to increase the timeout limite on all sites served by nginx. You must add –timeout 300 as well to your gunicorn process/config. This solved my problems in the past with … Read more

Host Django on subfolder

My comment doesn’t show the whole picture. When I’ve run Django sites on subfolders, I like to use a dynamic config so that you can still access the machine directly (without the proxy) and have a working web-app. This can help a LOT for debugging tricky stuff like this that is hard to reproduce in … Read more