Here’s a simple way to do it. For this example I will be creating the subdomain foobar.example.com
BTW, paths are all relative to the SWAG container’s storage mount point.
Create a new configuration file for your subdomain .../config/nginx/site-confs/foobar.subdomain.conf
with the following content:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
root /config/www/foobar;
index index.html index.htm index.php;
server_name foobar.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
location / {
# auth_basic "Restricted";
# auth_basic_user_file /config/nginx/.htpasswd;
include /config/nginx/proxy.conf;
}
}
NB: You should replace both instances of foobar
with your chosen subdomain.
The key lines in this configuration file are:
-
root
which tells nginx in which directory the content for the subdomain is located, and
-
server_name
which tells nginx which web requests should be processed by this particular server { ... }
block. In this case the expression foobar.*
tells nginx to match any domain beginning with foobar.
(as the *
is the match any character wildcard).
Save this file and exit your text editor. Copy your content for the subdomain to the location given in root
and restart the swag container. You should now be able to access your subdomain https://foobar.example.com
hope this works for you!