How can I change the domain of my AMP site to another

Hi

Is there any guidance on how I can transfer my AMP from one server to another?

I apologise is this is something not managed by AMP, I honestly forgot the setup process.

In my example, I have name cheap which is my domain provider, converting my AMP IP to domain1

domain1 is now expiring and I’ll buy domain2

How can I transfer my AMP from domain1 to domain2?

Many thanks

Do you want to move your entire AMP instance to a new Server, or do you just want to change your Domain, but stay on the same server? quite hard to follow.

Sorry!

Same server, just changing the website domain to access it.

Normaly AMP creates an nginx-config during setup, with your desired domain. You should be able to locate that nginx-config at /etc/nginx/sites-available/ or /etc/nginx/sites-enabled

If you find the config there, open it and change the server name to your new domain e.g.

server_name your-old-domain.com;server_name your-new-domain.com;

After that, restart nginx sudo service nginx restart

Of course, you will also need to create a new A-Record, in the DNS-Console of your new domain, to point towards your servers ip. I assume you have already done that for your old domain.

Thank you so much for this!
Following your response and a bit of toying, I managed to get it working.
For anyone else in the same boat as me, this is how I solved it.

1. Locate the nginx configuration

  • AMP’s nginx config was in /etc/nginx/conf.d/panel.<old-domain>.conf

2. Update the domain in the config

sudo nano /etc/nginx/conf.d/panel.<old-domain>.conf
  • Changed all instances of <old-domain> to <new-domain>

3. Rename the config file to match the new domain

sudo mv /etc/nginx/conf.d/panel.<old-domain>.conf /etc/nginx/conf.d/panel.<new-domain>.conf

4. Test and restart nginx

sudo nginx -t
sudo systemctl restart nginx

5. Update DNS Records on your domain provider

  • Added A Record: @<your-server-ip>
  • Added A Record: panel<your-server-ip>

6. Obtaine SSL Certificate

sudo certbot --nginx -d panel.<new-domain> -d <new-domain>

7. Fix certbot creating conflicting config (Important!)

sudo rm /etc/nginx/sites-enabled/default
sudo systemctl restart nginx

Many thanks