To begin enabling apps for a SharePoint Server, we will need to go into the DNS and create a forward-facing zone for our apps to be stored and accessed from.
Go to the Windows Administrative Tools and open up DNS.

In the DNS Manager, right-click on the Forward Lookup Zones (under your SharePoint Server), and then click New Zone... to open up the New Zone Wizard.

Click Next on the Wizard welcome page.

On the Zone Type page, ensure that the default Primary Zone is still selected, and click Next.

On the Active Directory Zone Replication Scope page, select the replication method that best fits your environment (the default of these options is "To all DNS servers running on domain controllers in this domain: (domain)", and click Next.

On the Zone Name page, enter a name for your new app domain name (modernapps.local or .com depending on your situation for example), and click Next.

On the Dynamic Update page, select the appropriate update method for your environment (the default of these methods is to not allow Dynamic Updating).

On the Completing the New Zone Wizard page, review your settings, and click Finish.

--Section 2--
Next we will set up the forwarding of all requests for the new zone to the SharePoint Server that is hosting the apps. Ensure that you are logged in as a Domain Admin for this section.
In the DNS Manager, in that same Forward Lookup Zone folder, right-click the app domain that was just created, and click New Alias (CNAME)...

In the New Resource Record dialog box, enter "*" as the new alias name. Then click the Browse button to fully qualify the domain name. Navigate to the Forward Lookup Zone for the domain that hosts the SharePoint sites and then navigate to the record that points to the server that hosts the site. Then click ok on both the navigation window, and the New Resource Record dialog.



Test out the new domain by opening the Command Prompt and give it a ping command (ping [SOMEPREFIX].[THEDOMAINCREATED]). For example, the command to ping the domain shown in the images is ping test.modernapps.local.

If the ping command returns the appropriate IP address, then the wildcard "*" was configured correctly.
--Section 3--
Next we need to ensure the proper services are running, and start/create them if they aren't. Verify that you are a member of the farm administrators’ group for this section.
In Central Administration Go to System Settings > Manage services on server and start these two services: App Management Service & Microsoft SharePoint Foundation Subscription Settings Service.

--Section 4--
In this step we'll create the service application we prepared for in the last step. We'll use PowerShell to set up the one that requires it. Verify that you have the following memberships: securityadmin fixed server role on the SQL Server instance, db_owner fixed database role on all databases that are to be updated, and Administrators group on the server you are running the PowerShell cmdlets from.
Create a new App Management Service Application from Central Admin > Application Management > Manage service applications.


And then run this script in PowerShell as an administrator:
$subscriptionSettingsServiceApplicationName = 'Subscription Settings Service Application'
$pool = Get-SPServiceApplicationPool 'SharePoint Web Services Default'
$subscriptionSettingsServiceDB= 'Sharepoint_SiteSubscriptionSettingsServiceDB'
$subscriptionSettingsServiceApplication = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $pool -Name $subscriptionSettingsServiceApplicationName -DatabaseName $subscriptionSettingsServiceDB
$subscriptionSettingsServicApplicationProxy = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $subscriptionSettingsServiceApplication

--Section 5--
From Central Administration, click Apps. Then from the Apps page, click Configure App URLs.

On the Configure App URLs page, enter the domain that was created for hosting apps. In the App prefix box, give a name to use for the URL prefix for apps, and click OK.

--Section 6--
This section is just testing to make sure the App environment is working.
Go to the site you plan to use and add an app from the SharePoint Store. Add it, and Click Trust It when the Do you trust this app dialog appears.
You Should see the app added (or being added) to your site content's page.
©2019 PremierPoint Solutions. All Rights Reserved.