The following procedure explains how to change the hostname and Management hostname of WSO2 API Manager (WSO2 API-M) as required for your production environment.
Open the
<API-M_HOME>/repository/conf/carbon.xml
file and set theHostName
andMgtHostName
property as shown below.Localtabgroup Localtab active true id Format-hostname title Format Code Block language xml <HostName>{hostname}</HostName> <MgtHostName>{management-hostname}</MgtHostName>
{hostname}
- Hostname or IP address of the machine hosting this server. This is will become part of the End Point Reference of the services deployed on this server instance.{management-hostname}
- Hostname to be used for the WSO2 API-M Management console.Localtab id example-hostname title Example Code Block language xml <HostName>am.dev.wso2.com</HostName> <MgtHostName>am.dev.wso2.com</MgtHostName>
- Generate a key store by following the sub steps given below.
Open a terminal and issue the following command to generate a key store.
Localtabgroup Localtab active true id Format title Format Code Block keytool -genkey -alias <hostname> -keyalg RSA -keystore <key-store> -keysize 2048
<key-store>
- This is the repository that stores the cryptographic keys and certificates.Localtab id example title Example Code Block keytool -genkey -alias am.dev.wso2.com -keyalg RSA -keystore apimkey.jks -keysize 2048
- Specify a preferred KeyStore password once prompted.
- Specify a preferred Key password once prompted.
Enter the first name and last name as follows once prompted.
Code Block *.am.dev.wso2.com
- Enter values for the other parameters as required.
am.dev.wso2.com
as the CN. - Copy the generated self-signed key store (i.e.,
apimkey.jks
) to the<API-M_HOME>/repository/resources/security
directory. - Export the public certificate from the keystore and import that certificate to the
client-truststore.jks
file following the steps given below. - Navigate to the
<API-M_HOME>/repository/resources/security
directory. Issue the following command to export the public certificate from the primary key store
Code Block keytool -export -alias am.dev.wso2.com -file am.dev.wso2.com -keystore apimkey.jks -storepass <keystore_password_given_above>
Issue the following command to import the certificate to the
client-truststore.jks
file.Code Block keytool -import -alias am.dev.wso2.com -file am.dev.wso2.com -keystore client-truststore.jks -storepass wso2carbon
Whats Next?
Info | ||
---|---|---|
| ||
After changing your hostname and management hostname, make sure to whitelist your hostname for the API Store. |