I got my local nginx serve 3 sites with the respective configurations below. They worked well that way in my local LAN (see below also for the dnsmasq config) when requested with A or A.domain. Now I wanted one of those sites to be available from the internet via a dyndns domain like B.domain.ddns.net.
I configured my router to forwarded port 81 (to not accidentally mask the admin interface of the router) to port 80 of my local server and added the lines currently commented out in the examples below except the default_server line.
I entered http://B.domain.ddns.net:81 as URL. It didn't work.
I assumed that maybe the subdomain somehow doesn't work with the dyndns system, so I additionally set one site to default_server
.
Now that made the site available from the internet, but suddenly one of the other sites is no longer available locally, neither with C nor C.domain, instead the default one is served.
Anybody know why this happens? Or why the dyndns domain does not match in the first place? Or how I can set the access log to show me the requested site WITH the domain string? Or maybe if there is a better way to serve just one site to the internet and the others locally?
Site A
server {
listen 80;
listen [::]:80;
server_name A.domain, A;
...
Site B
server {
listen 80;
# used this instead of previous line after specific domain below didn't work
# listen 80 default_server;
listen [::]:80;
server_name B.domain, B;
#used this instead of previous for external access
# server_name B.domain, B, B.domain.ddns.net;
...
Site C
server {
listen 80;
server_name C, C.domain;
dnsmasq-config
strict-order
local=/heimatsender/
expand-hosts
domain=heimatsender
log-queries
dhcp-range=192.168.1.100,192.168.1.200,255.255.255.0,168h
log-dhcp
dhcp-option=option:router,192.168.1.1
dhcp-hostsfile=/etc/dnsmasq-dhcphosts
dhcp-option=15,"domain"
dhcp-option=6,192.168.1.18
cname=A.domain,A
cname=A.domain.domain,A.domain
cname=Aalias,A
cname=Aalias.domain,A.domain
cname=C,A
cname=C.domain,A.domain
cname=B,A
cname=B.domain,A.domain
Update Removing the commas in the server_name field made the sites available from local LAN again. But from the internet, only domain.ddns.net:81
works to connect to the site configured as default server
. B.domain.ddns.net:81
doesn't, although configured as a server_name
. More help still welcome.