Multi level domain with CNAMEMulti level domain with CNAME

Its looks cool to have multi-level subdomains for different projects. example: or

DNS configuration

  • Goto DNS panel of your domain and create a CNAME record for you multi-level sub-domain which points to your real server.
  • For example:



  • Here, my single server serves two different APIs
  • Note: CNAME can be pointed to another domain only. So, is A record points my actual server (ex:
  • Google offers a great tool to verify your DNS configurations. You should check out Dig Tool.

Nginx configuration

  • You can add a config to serve the request, for example:
upstream strapi {
server {
    listen 80;
    listen [::]:80;

    location / {
         proxy_pass http://strapi;
         proxy_http_version 1.1;
         proxy_set_header X-Forwarded-Host $host;
         proxy_set_header X-Forwarded-Server $host;
         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 Upgrade $http_upgrade;
         proxy_set_header Connection "Upgrade";
         proxy_pass_request_headers on;