0

I recently purchased a VPS from a service. The hostname seems semi randomly generated

12jk34kd.vpsservice.example

It says I have the option to change the hostname but it looks like I can change the entire thing. As far as I understood, the hostname in this case is

12jk34kd

while the domain is

vpsservice.example

if I change the entire thing to

myserver.example.com

  1. I assume I need to own the domain example.com and have it pointing to the VPS server?
  2. To point a domain to the server, do I change the Nameservers of the domain or do I change the DNS Servers on the VPS? Or both?
  3. Also, is the main advantage simply that I can use the hostname over the IP address to connect to the server?

    i.e.

    ssh user@192.0.2.12

    becomes

    ssh user@hostname.example.com

  4. And if 3 is correct, if no other services use the server (database etc) and I login via ssh using the IP, is changing the server to use your own domain instead of its default domain really even needed?

  • Are you planning to run a website using this VPS? – Stephen Ostermiller Oct 6 '18 at 10:50
  • Just to note you can change your hostname to anything, there is no check where it wont allow you to do so. You could just hostname example.com in command line and it would set the hostname to anything you enter. That being said there are some tools ive found that will have long delays due to a failing host name lookup so it should be resolvable. – Analog Oct 6 '18 at 10:56
  • @StephenOstermiller Yes. Multiple actually, using a reverse proxy nginx server, but I guess at first I will just try and get one working – myol Oct 6 '18 at 11:19
1

The biggest advantage to pointing a host name at your VPS is that you can run a web server that serves documents at that host name. When you are telling other people about your site, the advantages of using your own domain name instead of an IP address or subdomain of your hosting company should be obvious. You are building your own brand. You can move to a new hosting company without getting your customers to update their bookmarks. Your search engine optimization will be better.

For the purposes of connecting to your machine via SSH, the host names are only for your convenience. There is no need to assign a host name to the machine for that purpose. Once you point a domain names to the server for your website, you would be able to use ssh user@myowndomain.example to connect to your box where myowndomain.example would be the domain name of your website.

To point a domain name at your server you should not point the NS records to your VPS. The NS records should point to your DNS host.

It is likely that your domain registrar offers DNS hosting services that you can use. If that is the case, you don't have to change the NS records at all, you would just add A records for your site pointing to your VPS IP address.

Your VPS hosting company should also offer DNS hosting services. If so, they will provide you with a list of NS servers (ns1.vpshost.example, ns2.vpshost.example, etc). You can change your NS records to those values and then add the A records at your VPS host.

  • Thanks Stephen. Is there any advantage to having your actual VPS server hostname point to / use your main sites domain name? Currently I have multiple sites running on my VPS server using their own domain names but the server hostname is still an arbitrary name. I was thinking of having the VPS server hostname changed to be a subdomin of my main site, but I can't think of any advantages of this apart from being able to use that subdomain instead of an IP to SSH in – myol Nov 16 '18 at 4:18
  • 1
    The hostname set in the operating system on the VPS probably won't show up to your customers. It is really just for your use. The only time I can think that it might appear is in the default error documents served by some web servers. I usually set it to something meaningful to me so that I know which server I'm on when I SSH in. – Stephen Ostermiller Nov 16 '18 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.