Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
290 views
in Technique[技术] by (71.8m points)

Allowing only local network access in NGINX for subdomain

Very similar question to this post: Allowing only local network access in NGINX

I have two subdomains running on nginx. [www].example.com and [vault].example.com. I would like for [vault].example.com to only be accessible from [www].example.com so I am trying to only allow the server ip to access the subdomain.

Following the post above, I created a private.conf

allow 192.168.1.0/24;
deny all;

But I am not sure where I should put my include /etc/nginx/private.conf. If I put it inside the nginx.conf file, it blocks the [www].example.com subdomain as well and I do not want that. I was unable to find a guide for where to put it inside the /sites-available/vault file as there is no http block and if I put it as the last line, it once again blocks access to [www].example.com from the public.

/etc/nginx/sites-available/vault

server {
    location {
    ...
    }
...
}

upstream backend {
...
}

server {
    location {
    ...
    }
...
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...