Apache2 How to enter by domain and not ip? [closed]


I have an apache server in a vps, and in the / path / apache2 / sites-available folder I have the config of my web page.

How can I do to not have to enter the ip? Do I have to buy a domain?

Ex current: link - > link

asked by marc 01.01.2017 в 16:31

2 answers


It depends on where you buy the domain, if you have an internal DNS etc. The most basic and general configuration that you can suggest is once you buy the domain you must edit the DNS Zone, add a record A, placing in name or host the value www and as a value place the public IP from your server.

So if you buy the domain marc.com when you add the record A mentioned, you will have www.marc.com that resolves to your public IP.

Depending on what company you have purchased, they will put at your disposal some tool or interface from where you can manage your domain, for example, you can do it in godaddy , or in CPanel

answered by 02.01.2017 / 04:37

Depends on the OS of the server, for example


You must edit this file: /$ sudo vi /etc/hosts

Here you put the ip and next to the name with which you want to access.

I leave the source where I got the information from. Source

answered by 01.01.2017 в 16:48