Mobile app version of vmapp.org
Login or Join
Si4351233

: Add domain to VPS (DNS?) I have a VPS and some domains. I want to add one of my domains to the VPS. My VPS provider has send me his Nameservers like ns1.example.com and ns2.example.com and

@Si4351233

Posted in: #Apache #Dns #Domains #Ubuntu #Vps

I have a VPS and some domains. I want to add one of my domains to the VPS.

My VPS provider has send me his Nameservers like ns1.example.com and ns2.example.com and I changed these DNS records in my domain panel.

Should I now install a DNS server on my VPS, add a record to Apache configuration file, or edit hosts file?

The OS is Ubuntu with Apache btw.

What exactly should I do?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Si4351233

2 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

To get a website up at a domain name you need to follow these steps:


Register the domain name.
At the registrar, point the NameServer (NS) records to the domain name server (DNS) that will be handling the domain.
On the name server, add records to resolve the host name to your server.
Configure your web server to handle requests that come in for that domain name.


I never run my own name server. Third party name server service is dirt cheap and much more reliable. I wouldn't pay more than per year for it. You really should have three or four name servers running in different locations for redundancy and reliability. It sounds like your web host has name servers for you to use and I would take advantage of that.

The DNS records on the name server can be either A records that list the IP address of your web server, or CNAME records pointing to another host name that you have already set up to point to your server. Your web host has a way for you to add these records. It is usually a web interface they give you in a control panel where you can create these records.

On Ubuntu, the recommend way to add Apache configuration for a website (substitute example.com for your actual domain name) is:


Create a directory for the files to be served /var/www/example.com and put the HTML files there.
Create /etc/apache2/sites-available/example.com.conf:

<VirtualHost *:80>
Servername example.com
DocumentRoot /var/www/example.com
<Directory /var/www/example.com/>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Enable the site: sudo a2ensite example.com
Restart the webserver: sudo service apache2 restart

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme