Link a domain name to my VPS

This article is about Apache version 2.4.38

  1. The domain name must point to the IP address of your VPS.
  2. Connecting to the VPS via SSH
  3. Create the vhost file associated with the :
    nano /etc/apache2/sites-available/yourdomain.conf
  4. Add this to the :
ServerName yourdomain.tld
    ServerAlias alias.yourdomain.tld
    ServerAlias youralias.tld
    DocumentRoot /home/yourdomain/www
    
    	Options FollowSymLinks
    	AllowOverride All
  1. Save and close the file: CTRL+O, enter then CTRL-X
  2. Enable vhost in apache :
    a2ensite yourdomain.conf
  3. Restart apache :
    /etc/init.d/apache2 restart
Updated on 20 October 2022

Related Articles