Customize the API Store and Gateway URLs for Tenants
The default URL of WSO2 API Manager Store is https://<HostName>:9443/store.
You can change the URL of the Gateways and API Store tenants in WSO2 API Manager as follows:
Install Nginx and create SSL certificates
Follow the steps below to install Nginx and create SSL certificates
Remove your current installation of Nginx using the command below.
sudo apt-get purge nginx nginx-common nginx-full
Run the following command and install Nginx.
sudo apt-get install nginx
Create an SSL certificate.
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
Go to <APIM_HOME>/repository/resources/security and use the following command to add the certificate to the client trust store.
keytool -import -file /etc/nginx/ssl/nginx.crt1 -keystore client-truststore.jks -storepass wso2carbon -alias wso2carbon2
Open /etc/nginx/sites-enabled/default in your terminal and add the following configurations with your custom domain name.
server { listen 443; ssl on; ssl_certificate /etc/nginx/ssl/nginx.crt; ssl_certificate_key /etc/nginx/ssl/nginx.key; location / { proxy_set_header X-WSO2-Tenant "ten5.com"; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_pass https://localhost:9443/store/; proxy_redirect https://localhost:9443/store/ /; proxy_redirect <custom URL>; proxy_cookie_path /store/ /; } }
Setup custom domain mapping in the registry
Log in to the management console as (
https://<HostName>:9443/carbon
) as admin (or tenant admin).- In the Main menu, click Browse under Resources.
Navigate to /_system/governance registry path and create the following directory structure in the registry.
In API Cloud this directory structure is created automatically when you are specifying the custom URL through UI.
customurl/api-cloud/<tenant-id>/urlMapping/<tenant-id>
.To create a directory in the registry path,
1. navigate to the location in the registry browser, click and open the location.
2. Click Add Collection and specify the name of the directory and click Add.
Navigate to
/_system/governance/customurl/api-cloud/<tenant-id>/urlMapping/<tenant-id>
. Click Add Resources under Entries and select Create Text Content.Add the following resource configurations to the registry and click Add.
{ tenantDomain: "<tenant domain name>", "store" : { "customDomain" : "<custom domain for store>" }, "gateway" : { "customDomain" : "<custom domain for gateway>" } }
Configure the store webapp
Go to
<APIM_HOME>/repository/deployment/server/jaggeryapps/store/site/conf
directory, open thesite.json
file and add the tenant header parameter as shown below."reverseProxy" : { "enabled" : auto, "host" : "sample.proxydomain.com", "context":"", "tenantHeader" : “X-WSO2-Tenant” },
You can choose any name for the header and set the virtual host to create the specific domain.
For details on how to create and manage multiple tenants, see Managing Tenants. You can also see Multi-tenant Architecture for more information about tenants.