E
E
Evgeny Mikhailovsky2019-10-19 21:58:25
Nginx
Evgeny Mikhailovsky, 2019-10-19 21:58:25

How to create subdomain for lxd container?

I have lxc on my server. Each lxc has a different resource. I forward each resource to the network through nginx. Here's how:

upstream name-container {
  server ип контейнера:(порт какой надо пробросить);
}
server {
  listen domen:(порт на который пробросить);
  proxy_connect_timeout 3600s;
  proxy_timeout 3600s;
  proxy_pass name-container;
}

How to access a resource by subdomain if it is in a container

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
fdroid, 2019-10-19
@feelan

Virtual host config for one subdomain:

server {
    listen 80;
    server_name subdomain.example.com;
    access_log /var/log/nginx/subdomain.example.com-access.log;
    error_log /var/log/nginx/subdomain.example.com-error.log;
 
location / {
    proxy_pass http://192.168.13.31:85;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    }
}

For other subdomains, configure virtual hosts in the same way.

S
Sanes, 2019-10-19
@Sanes

Regular Nginx Proxy. You don't even need to forward ports.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question