Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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. 

  1. Open the <API-M_HOME>/repository/conf/carbon.xml file and set the HostName and MgtHostName property as shown below.

    Localtabgroup
    Localtab
    activetrue
    idFormat-hostname
    titleFormat
    Code Block
    languagexml
    <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
    idexample-hostname
    titleExample
    Code Block
    languagexml
    <HostName>am.dev.wso2.com</HostName>
    <MgtHostName>am.dev.wso2.com</MgtHostName>
  2. Generate a key store by following the sub steps given below.
    1. Open a terminal and issue the following command to generate a key store.

      Localtabgroup
      Localtab
      activetrue
      idFormat
      titleFormat
      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
      idexample
      titleExample
      Code Block
      keytool -genkey -alias am.dev.wso2.com -keyalg RSA -keystore apimkey.jks -keysize 2048
    2. Specify a preferred KeyStore password once prompted.
    3. Specify a preferred Key password once prompted.
    4. Enter the first name and last name as follows once prompted.

      Code Block
      *.am.dev.wso2.com
    5. Enter values for the other parameters as required. 
    Once this information is submitted, a key store is generated with a private key and a public certificate with am.dev.wso2.com as the CN.
  3. Copy the generated self-signed key store (i.e., apimkey.jks) to the <API-M_HOME>/repository/resources/security directory.
  4. Export the public certificate from the keystore and import that certificate to the  client­-truststore.jks  file following the steps given below.
    1. Navigate to the <API-M_HOME>/repository/resources/security directory.
    2. 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> 
    3. 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
iconfalse

After changing your hostname and management hostname, make sure to whitelist your hostname for the API Store.