Nginx: the Internet and the website from the local network?

There is a Debian server 9, it with nginx + php-fpm.
Configuration of site access from the Internet:
user.site.com

server {
listen 80 default_server;
server_name user.site.com www.user.site.com;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;

ssl_certificate /home/back/ssl-key/mycert.crt;
ssl_certificate_key /home/back/ssl-key/device.key;

root /home/agent/user.site/public;
index index.php;

access_log /var/log/nginx/site-access.log;
error_log /var/log/nginx/site-error.log;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
location unix:/run/php/php7.3-fpm.sock;
}

location ~ /\.ht {
deny all;
}
}


Config for access from the inside:
admin.site.com

server {
listen 80;
server_name admin.site.com www.admin.site.com;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;

ssl_certificate /home/back/ssl-key/mysert.crt;
ssl_certificate_key /home/back/ssl-key/device.key;

root /home/back/admin.site/public;
index index.php;

access_log /var/log/nginx/site-access.log;
error_log /var/log/nginx/site-error.log;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
location unix:/run/php/php7.3-fpm.sock;
}

location ~ /\.ht {
deny all;
}
}


The website user.site.com works, but to get access to the site admin.site.com need to fix your hosts file and add:
hosts

local_ip_addr admin.site.com


Actually, the question is: can I configure nginx to avoid editing the hosts file?
March 23rd 20 at 19:30
1 answer
March 23rd 20 at 19:32
Solution
is it possible to configure nginx to avoid editing the hosts file?

No, without changing the hosts care about your local nginx doesn't even.

Find more questions by tags Nginx