When migrating a website to a new server, you usually want to view the website before changing the domain's DNS to point to the new server.
This tutorial will show you how to preview apps when you have more than one app on your server or when using a staging server.
To preview an app using your server's IP address, go to the app's Domains tab and add your server's IP address as one of the app's domain names.
If your server has multiple IP addresses or uses a DigitalOcean Floating IP, add the IP address you will make requests to using your browser even if that's not your server's primary IP address.
To preview an app using a preview domain name, complete these steps:
Once you've completed the above steps and the DNS change has become active, you'll be able to view your app using the URL http://preview.YOURDOMAIN.com.
Note that the preview domain can be completely different than the live domain the app will use. For example, if your development company is devcompany.com and the app's domain will be yourclient.com, you can use a preview domain, such as yourclient.devcompany.com.
If you have many apps on a server and you do not want to configure a separate DNS record for each one, you can create a wildcard DNS record that points to your server's IP address. Using this approach, you still need to add a specific preview subdomain for each app in ServerPilot, but you avoid needing to add a DNS record each time you create a new app.
Here's how you can set up preview domain names using wildcard DNS:
You can now preview each app using http://APPNAME.preview.srv1.devcompany.com.
When you add another app to your server, you do not need to make any DNS changes. You only need to add the domain name NEWAPPNAME.preview.srv1.devcompany.com to the new app in ServerPilot.
When you add another server to your ServerPilot account, you should create a new wildcard DNS record for that server. For example, if this new server's hostname is srv2.devcompany.com and its IP address is 188.8.131.52, you should create a wildcard DNS record for *.preview.srv2.devcompany.com that resolves to 184.108.40.206.