VPS domain connecting from same PC

Started by Austin, Sep 01, 2022, 12:02 AM

Previous topic - Next topic

AustinTopic starter

Raised Ubuntu server on virtual-box
Installed nginx
Bought from the provider "real ip"
registered pp.ua domain

How to force by domain name to switch to a virtual machine?
In fact, I'm sitting from the desktop, and vps on the same desktop and from under it I'm trying to legalize through the domain name to nginx on the virtual machine ..

And what about the ns server, how does it participate in that?
The signal does not go further than the router, upon request from the browser, it throws at 192.168.1.1, in short, I get into the admin panel of the router by my domain name.
  •  

jainteq

you need to set up zone management and associate an IP with a domain (these capabilities are usually provided by the domain registrar).
Well, the virtual server must have a setting to bind IP to the domain name (sometimes they forget to write it in the /etc/host file).

But the question is too general, first try to get a response from the server from the machine where the server is installed, if possible, then from other machines.
get a white ip from an internet provider,
 redirect incoming traffic to the virtual machine,
Plus, make the A-record of the domain name lead to your white ip-provider, and already your PC will redirect incoming traffic to the virtual machine.
  •  

ManiQuadraIncorp

host file is an operating system (OS) file, not a server file. generally, the concept of a server is quite broad, from physical hardware (sometimes separated by thousands of kilometers), to various software, for instance, server operating systems, HTTP servers, ftp servers, and further on protocols and types of address data, for example, DNS servers, IP servers telephony, etc. In a broad sense, a server is an active network unit, i.e. some means (hardware or software) that can respond to requests without human intervention. In fact, the elements of the server contain all modern developed systems AND client ones as well).

I also recommend clarifying how the virtual machine's network connection is organized, in order for it to work as a server, the best option (in terms of simplicity) is a network bridge, then it will listen directly to the external network and it will be enough to configure the server and server OS running inside the virtual cars.
On the other hand, in the base OS, it is possible to deploy a proxy server that will filter traffic and redirect just the necessary requests to the virtual machine.
  •  

arold10

  A-record
The easiest way to send a domain to a VPS is through an A-record. Here's how to do it:
Find the IP address of your VPS
Go to your domain's DNS zone and delete all A-records that have @, www, or cloudflare-resol-to in their name.

Add these two new A-records

A-entry 1

A-entry 2

Name: @

Indicates: The IP address of your VPS

TTL: Default

Name: www

Indicates: The IP address of your VPS

TTL: Default

 
 A- and CNAME-records
Find the IP address of your VPS
Go to your domain's DNS zone and delete all A-records that have @, www, or cloudflare-resol-to in their name.

Add this A- and CNAME-record.

A-record

CNAME record

Name: @

Indicates: The IP address of your VPS

TTL: Default

Name: www

Indicates: Your domain name (for example, domen.com )

TTL: Default

 
 Child Name servers
If you choose one of the options above, your domain will continue to use its old name servers. If you want to use your own name servers, for example:

ns1.domen.com

ns2.domen.com

Then the option with child name servers will suit you, the procedure will look like this:
Make sure that your VPS has a working DNS zone (especially if you are using a VPS without a template). If the DNS zone is not configured yet, follow this guide first.

Create child name servers.
Change your current name servers to the new ones.
Any changes to DNS records trigger the delegation process, which can take up to 24 hours.
  •