Update the IP address or hostname
Magento requires updating the IP address/domain name if the machine IP address/domain name changes. The bnconfig tool also has an option which updates the IP address, called --machine_hostname (use --help to check if that option is available for your application). Note that this tool changes the URL to http://NEW_DOMAIN/.
$ sudo installdir/apps/magento/bnconfig --machine_hostname NEW_DOMAIN
If you have configured your machine to use a static domain name or IP address, you should rename or remove the installdir/apps/magento/bnconfig file.
$ sudo mv installdir/apps/magento/bnconfig installdir/apps/magento/bnconfig.disabled
NOTE: Be sure that your domain is propagated. Otherwise, this will not work. You can verify the new DNS record by using the Global DNS Propagation Checker and entering your domain name into the search field.
You can also change your hostname by modifying it in your hosts file. Enter the new hostname using your preferred editor.
$ sudo nano /etc/hosts
Add a new line with the IP address and the new hostname. Here’s an example. Remember to replace the IP-ADDRESS and DOMAIN placeholders with the correct IP address and domain name.