Nginx subdomain configuration

You could move the common parts to another configuration file and include from both server contexts. This should work: server { listen 80; server_name server1.example; … include /etc/nginx/include.d/your-common-stuff.conf; } server { listen 80; server_name another-one.example; … include /etc/nginx/include.d/your-common-stuff.conf; } Edit: Here’s an example that’s actually copied from my running server. I configure my basic server … Read more

Using variables in Nginx location rules

You can’t. Nginx doesn’t really support variables in config files, and its developers mock everyone who ask for this feature to be added: “[Variables] are rather costly compared to plain static configuration. [A] macro expansion and “include” directives should be used [with] e.g. sed + make or any other common template mechanism.” http://nginx.org/en/docs/faq/variables_in_config.html You should … 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)