08-31-2016, 03:08 PM
Hey guys,
I'm gonna make a short tutorial on how you can link your bought domain to your VPS, you can even link it to someone's else VPS, this was covered recently in a topic but most people do not like to search so I think some people may find it useful if such a topic is located in tutorials.
So to start, make sure you have a domain and a DNS manager. I usually use Namecheap 88S offer domains [ .us / .xyz are my favorites ] and then use Cloudflare for DNS managing, to start, point your domain to your VPS IP for e.g. :
after that SSH into ur VPS make sure you have root / sudo rights.
choose a directory for your website, for e.g. we choose /var/www/website for our tutorial.
make those directories.and put index.html files in them with any text as these will be the files our browsers will open when we goto that directory.
after that goto /etc/apache2/sites-available
create file matching the name to your website, in our case website.
and insert these lines into the configuration file :
you can also add sub domains this way
now enable the site using a2ensite, just enter a2ensite website in the console
and reload apache
I'm gonna make a short tutorial on how you can link your bought domain to your VPS, you can even link it to someone's else VPS, this was covered recently in a topic but most people do not like to search so I think some people may find it useful if such a topic is located in tutorials.
So to start, make sure you have a domain and a DNS manager. I usually use Namecheap 88S offer domains [ .us / .xyz are my favorites ] and then use Cloudflare for DNS managing, to start, point your domain to your VPS IP for e.g. :
after that SSH into ur VPS make sure you have root / sudo rights.
choose a directory for your website, for e.g. we choose /var/www/website for our tutorial.
make those directories.and put index.html files in them with any text as these will be the files our browsers will open when we goto that directory.
after that goto /etc/apache2/sites-available
create file matching the name to your website, in our case website.
Code: (Select All)
sudo nano website.conf
Code: (Select All)
<VirtualHost *:80>
DocumentRoot /var/www/website
ServerName website.com
ServerAlias www.website.com
</VirtualHost>
Code: (Select All)
sudo nano blog.website
<VirtualHost *:80>
DocumentRoot /var/www/blog.website
ServerName blog.website.com
ServerAlias www.blog.website.com
</VirtualHost>
now enable the site using a2ensite, just enter a2ensite website in the console
and reload apache
Code: (Select All)
service apache2 reload
and now you should be able to goto that index.html file using your domain, It may not take affect instantly so if it didnt work than wait a few hours so changes can take effect and make sure your clear your cache [ Ctrl + F5 ].
If you face any issues reply so I can help ya out!