Hello, @harrywilson100
Are you hosting the site on a plain Ubuntu droplet or you have a control panel like cPanel/WHM installed as well? The process may vary with the different configuration.
If you simply have a LAMP/LEMP stack droplet you will need to update your virtual hosts and also rename the file for the domain name as well. The location of the vhosts on Ubuntu droplet is the following: /etc/apache2/sites-available
and a symlink in the /etc/apache2/sites-enabled
directory as well.
You can open the configuration file of the domain name and then change the lines that KFSys already mentioned:
ServerName
ServerAlias
Also to rename the file you can just use mv
:
mv yourdoman.com.conf newdomain.com.conf
Then you can check the Apache configuration for any syntax errors using this command:
sudo apachectl -t
If you get Syntax OK you can go ahead and restart Apache with this command:
service apache2 restart
If you’re using Nginx the location of the configuration files is /etc/nginx/sites-available/
and the line you need to change in the file is the server_name
and then you can again rename the file to match the new domain name.
Test your the configuration file for syntax errors by typing:
sudo nginx -t
You will also need to change the domain name in the WordPress installation as well. You can check this question that was previously asked in our community in order to do that:
https://www.digitalocean.com/community/questions/change-url-in-wordpress?answer=59927
Hope that this helps!
Regards,
Alex