Sub-domains through different /etc/nginx/sites-enabled entries?

Hello,

I’m refining here my question that remained unanswered under the topic
“Distribution of requests to multiple lxc containers” …

Is it possible to distribute sub-domains of one domain through
independent
files/links in sites-available/sites-enables entries? I’d love to have
the
flexibility to enable/disable services running at different sub-domains
without having to edit a (joined) file/link, but with the two entries
below
requests to “mail.MYDOMAIN.org” (trying to reach a lxc
container (supposedly) proxied by the second entry) end up returning an
error produced by the the first one.

Thanks for any pointers on what I might be doing wrong or whether I have
to
resort to one sites-available/enabled file.

Joh

server {
listen 443;
server_name MYDOMAIN.org HOSTING.net;
client_max_body_size 40M;
# SSL is using CACert credentials
ssl on;
ssl_certificate /etc/ssl/private/cacert.MYDOMAIN.org.pem;
ssl_certificate_key
/etc/ssl/private/cacert.MYDOMAIN.org_privatkey.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:!LOW:RC4+RSA:+HIGH:+MEDIUM:+SSLv3:
+EXP;
ssl_prefer_server_ciphers on;
# Proxy the “plone.MYDOMAIN.org” lxc container
location / {
proxy_pass
http://10.10.10.2:8080/VirtualHostBase/https/HOSTING.net:443/MYDOMAINPlone/VirtualHostRoot/;
}
}

server {
listen 443;
server_name mail.MYDOMAIN.org mail.HOSTING.net;
client_max_body_size 40M;
# SSL is using CACert credentials
ssl on;
ssl_certificate /etc/ssl/private/cacert.MYDOMAIN.org.pem;
ssl_certificate_key
/etc/ssl/private/cacert.MYDOMAIN.org_privatkey.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:!LOW:RC4+RSA:+HIGH:+MEDIUM:+SSLv3:
+EXP;

Johannes,

Is this what you are asking for?

cat /etc/nginx/sites-enabled/site1

server {
listen 80;
server_name subdomain1.domain.com
# config…
}

cat /etc/nginx/sites-enabled/site2

server {
listen 80;
server_name subdomain2.domain.com
# config…
}

cat /etc/nginx/sites-enabled/siteN

server {
listen 80;
server_name subdomainN.domain.com
# config…
}

where:

/etc/nginx/sites-enabled/siteX

is a symlink to:

/etc/nginx/sites-available/siteX

Yes, this is possible :slight_smile:


Unai R.
Cofounder
LeanWired LLP
www.leanservers.com
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs