To add a custom domain to your VPS, you will need to follow these steps:
- Purchase a domain name from a domain registrar (such as Nest Nepal).
- Set up DNS records for your domain to point to your VPS. This usually involves creating an "A" record that points your domain to the IP address of your VPS.
- Configure your VPS to accept traffic for your domain. This usually involves setting up a virtual host in your web server software (such as Apache or Nginx) and pointing it to the directory where your website files are stored.
Here is an example of how to set up a virtual host in Apache:
- Edit the Apache configuration file (usually located at /etc/apache2/httpd.conf or /etc/httpd/conf/httpd.conf) and add the following lines, replacing example.com with your domain name and /var/www/example.com with the path to your website files:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example.com
<Directory /var/www/example.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
-
Save the configuration file and restart Apache for the changes to take effect.
-
Test your configuration by accessing your website using your domain name.
Note: The specific steps for setting up a custom domain on your VPS may vary depending on your operating system, web server software, and DNS provider. If you run into any issues or have any questions, it is a good idea to consult your VPS provider or a qualified system administrator for assistance.
