The usual way to do this is to have some kind of reverse proxy (usually Apache or nginx or HAProxy) running on port 80, and have it rout the requests to appropriate api (since only one service can run on on port, your apis will then run for example on 8081, 8082, etc..). (This is common setup even with one service that is not running on port 80, for example you can often find Apache running on 80 in front of the Tomcat running on 8080).
The example .conf for Apache could be:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/static-html-for-example.com-if-needed
<Directory /var/www/html/static-html-for-example.com-if-needed>
Options +Indexes
Order allow,deny
Allow from all
</Directory>
#LogLevel debug
ErrorLog logs/error_log
CustomLog logs/access_log common
ProxyPass /api1 http://127.0.0.1:8081/api1
ProxyPassReverse /api1 http://127.0.0.1:8081/api1
ProxyPass /api2 http://127.0.0.1:8082/api2
ProxyPassReverse /api2 http://127.0.0.1:8082/api2
# backend api even does not have to be on the same server, it just has to be reachable from Apache
ProxyPass /api3 http://10.10.101.16:18009/api3
ProxyPassReverse /api3 http://10.10.101.16:18009/api3
</VirtualHost>
And here is a sample nginx conf for app and api [two servers]:
upstream app {
server 127.0.0.1:9090;
keepalive 64;
}
upstream api {
server 127.0.0.1:8081;
keepalive 64;
}
#
# The default server
#
server {
listen 80;
server_name _;
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
#proxy_set_header Connection "";
#proxy_http_version 1.1;
}
location /{
rewrite /(.*) /$1 break;
proxy_pass http://app;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
#proxy_set_header Connection "";
#proxy_http_version 1.1;
}
# redirect not found pages to the static page /404.html
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}