Change site host url

Is it possible to change/update the site host value after a site is created?

When creating my first site, i setup mydomain.local, but i want to change it to local.mydomain.com. I’ve added that to my NGINX config via the NGINX Editor and updated my DB site and home urls as well as manually added that to my hosts file and the site will respond to that, but I think it is causing other issues.

do i have to basically export everything and create a new site with that name and then reimport everything?

Also it doesn’t seem like you can create a site with subdomain.domain.com and that only domain.tld can be done.?

Thanks
Bob

Mac OS 12.6.5
DevKinsta Version 2.10.0 (2.10.0.6571)
Not a Kinsta hosting customer

Hello @balbert and welcome to DevKinsta Community!
You won’t need to do this change manually, you can set a subdomain as primary domain directly in DevKinsta.

Create a new site and called it subdomain, this will create a new site having subdomain.local as primary domain.
Once that’s done, open the site page in DevKinsta and scroll down until you see the option called Top level domain. There you will be able to edit the site host by writing .domain.com (or whatever root domain you would like to use). This will then allow to have your host changed in subdomain.domain.com, all the needed changes in Nginx and database will be handled by DevKinsta.

Regards,
Alessandro

Hello!

Thanks so much for the guidance on renaming the TLD to .domain.com and relying on site name for the subdomain. It appears to work great! However, it seems like re-syncing your local site from Kinsta will break the config and changes the TLD back (in my case, it reverted it to .com - presumably to match the remote URL?).

When I try to fix this by re-attempting the rename process as mentioned, it goes through the process of updating root certificates & my hosts file… but it seems to fail silently? The domain TLD never gets updated and stays as .com, and once I restart Docker Engine and DevKinsta, it fails to start. DevKinsta gives the error DK0005, and the Nginx container in Docker is stuck in a loop, restarting after outputting the following log (I’ve changed the real domain to example.com).

2023-05-26 08:57:02 2023/05/26 14:57:02 [emerg] 1#1: cannot load certificate "/www/kinsta/ssl/local.example.com.crt": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/www/kinsta/ssl/local.example.com.crt, r) error:10000080:BIO routines::no such file)
2023-05-26 08:57:02 nginx: [emerg] cannot load certificate "/www/kinsta/ssl/local.example.com.crt": BIO_new_file() failed (SSL: error:80000002:system library::No such file or directory:calling fopen(/www/kinsta/ssl/local.example.com.crt, r) error:10000080:BIO routines::no such file)

My assumption is that this is a bug with the sync, but wanted to raise it and see if y’all were aware and knew of any workarounds or fixes.

Thanks!
Colby

macOS 13.3.1(a)
DevKinsta 2.10.0.6571

Hey @colby.l :wave: welcome to DevKinsta’s Community!

Regarding the issue with the sync, can you please verify if inside the wp-config.php you had a define that was forcing the site url/home?

About the SSL certificate, if you open your finder and move to ~/Devkinsta you should see a folder called ssl. Can you see a certificate (.crt file) named as the old domain? If so, if you do a preview of it (just select it and press the spacebar to use QuickLook), is the Common Name field showing the old or new domain?

Regards,
Alessandro

Just double-checked and we do not define a WP_HOME or WP_SITEURL within our wp-config.php. And the ssl folder appears to be empty…

Hey @colby.l

Can we try adjusting the settings of the Site in DevKinsta by deactivating HTTPS, changing the TLD to another domain, changing it back to the real domain, then reactivating HTTPS? I think hopefully that should reset the NGINX configuration, and apply the certificate to the right hostname, and should then appear in the ssl folder.

Let us know!

Best regards,
Zach