Need Nginx Config File to Accomplish Multiple Subdomain Reverse Proxy


I need help getting working nginx config files for my “reverse proxy” use case.

I am running multiple LXC containers on one dedicated server (Ubuntu 14.04) with one main IP and want each container reachable from the same one public IP, but with their unique subdomains.

To accomplish this, I am using one container as an nginx reverse proxy.

I have created A records to assign the subdomains to the main IP and created IP table rules to route the main IP to each container’s “internal IP address”.

Using nginx reverse proxy, I now want to link each subdomain to the internal IP address of each container so that when I go to a subdomain, it pulls up the corresponding LXC container.


My research has uncovered these approaches:

[url removed, login to view]

[url removed, login to view]

I have tried these approaches without success. These are the errors so far:

1. Upstream Error

I first got this error:

[emerg] "upstream" "directive is not allowed here" in /etc/nginx/[url removed, login to view]

I followed a suggestion to wrap the upstream directives in an http block and this upstream error went away.

2. Server Error

I now have this error:

nginx: [emerg] "server" directive is not allowed here in /etc/nginx/[url removed, login to view]

I also created IP Table routings to each container’s internal IP address using this format:

# iptables -t nat -I PREROUTING -p tcp -d <external IP> -j DNAT --dport <port> --to-destination <internal IP:80>

Finally, I also created self-generated SSL certificates to make sure each subdomain is accessed via https. See [url removed, login to view]


Attached is the format of the config file I used.

I need nginx config files that work on my dedicated server that will bind each subdomain to the LXC container. For example:

• <[url removed, login to view]> should to go <lxc container 1 with internal_IP_address-1>

• <[url removed, login to view]> should to go <lxc container 2 with internal_IP_address-2>

• <[url removed, login to view]> should to go <lxc container 3 with internal_IP_address-3>

• <[url removed, login to view]> should to go <lxc container 4 with internal_IP_address-4>

The deliverables should include:

• any config files to be used in the reverse proxy LXC container as well as in the config files of the other LXC containers

• appropriate SSL config settings to use https/self-generated SSL cert.

• corrections to any IP Table rules/DNS settings and other instructions to accomplish the reverse proxy goals.

We’ll set up an online meeting to do a real time install of the config files via screen sharing to make sure the files work and to do any final troubleshooting.

Habilidades: Linux, Nginx, Administrador do Sistema, Ubuntu

Veja mais: use case tutorials, use case include example, use case include, use case how to, t online dns server, example of work certificate, dns proxy server linux, nginx reverse proxy multiple backend servers, nginx reverse proxy multiple servers, squid nginx reverse proxy, nginx reverse proxy sessions, nginx reverse proxy forward ip, nginx reverse proxy configuration, nginx reverse proxy config, nginx reverse proxy, install nginx reverse proxy, nginx reverse proxy cache

Acerca do Empregador:
( 4 comentários ) Los Angeles, United States

ID do Projeto: #7711645

Concedido a:


A proposal has not yet been provided

$50 USD em 1 dia
(107 Comentários)

3 freelancers estão ofertando em média $167 para esse trabalho


Hello Sir, I am Working with 3 tier Data Center Organization as a Linux Expert, I have more than 8 years experience in, Linux Servers Setup, Configuration, Security, Web hosting, Database, Mail Services Administration Mais

$150 USD em 1 dia
(82 Comentários)

we are experts in nginx and have several of our own websites running within our infrastructure. I would be happy to help you get your multiple sites hosted on same server. are you using docker for deploying your Mais

$300 USD in 3 dias
(0 Comentários)