Open Closed

How to host multiple sites on single Azure web app for Containers using docker compose #9968


User avatar
0
devchase321 created

How to Deploy Multiple Applications on a Single Azure App Service Using Web App for Containers and Expose Multiple Endpoints on the Same Domain

  • https://www.example.com → Web Public
  • https://www.example.com/admin → Blazor Admin
  • https://www.example.com/api → API
  • https://www.example.com/auth → AuthServer

We want to avoid using multiple App Services or subdomains if possible and would like to maintain the same HTTPS certificate for all endpoints.


6 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    To host multiple ABP applications (Web Public, Blazor Admin, API, AuthServer) on a single Azure App Service using Web App for Containers with Docker Compose, and expose them under different paths on the same domain, you need to use a reverse proxy container (such as Nginx or Traefik) as the entry point. This proxy will route requests to the correct internal service based on the URL path.

    Step-by-Step Solution

    1. Prepare Docker Images for Each App

      • Build/publish Docker images for each ABP application: Web Public, Blazor Admin, API, and AuthServer.
      • Push these images to a container registry (e.g., Azure Container Registry or Docker Hub).
    2. Create a Reverse Proxy Configuration

      • Use Nginx (or Traefik) as a reverse proxy to route traffic based on the URL path.
      • Example Nginx configuration (nginx.conf):
    server {
             listen 80;
             server_name www.example.com;
    
             location / {
                 proxy_pass http://webpublic:80;
             }
             location /admin/ {
                 proxy_pass http://blazoradmin:80/;
                 rewrite ^/admin(/.*)$ $1 break;
             }
             location /api/ {
                 proxy_pass http://api:80/;
                 rewrite ^/api(/.*)$ $1 break;
             }
             location /auth/ {
                 proxy_pass http://authserver:80/;
                 rewrite ^/auth(/.*)$ $1 break;
             }
         }
    
    • This configuration assumes your internal Docker services are named webpublic, blazoradmin, api, and authserver.
    1. Create a docker-compose.yml File
      • Example:
    version: '3.8'
         services:
           nginx:
             image: nginx:latest
             ports:
               - "80:80"
             volumes:
               - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
             depends_on:
               - webpublic
               - blazoradmin
               - api
               - authserver
    
           webpublic:
             image: <your-registry>/webpublic:latest
             environment:
               # Set environment variables as needed
             # ...
    
           blazoradmin:
             image: <your-registry>/blazoradmin:latest
             environment:
               # ...
             # ...
    
           api:
             image: <your-registry>/api:latest
             environment:
               # ...
             # ...
    
           authserver:
             image: <your-registry>/authserver:latest
             environment:
               # ...
             # ...
    
    1. Deploy to Azure App Service for Containers

      • Zip your docker-compose.yml and nginx.conf and deploy to your Azure App Service configured for multi-container (Docker Compose) deployment.
      • Ensure your App Service is set to use Linux and supports Docker Compose.
    2. HTTPS Configuration

      • Azure App Service provides a built-in SSL certificate for your domain. All traffic will go through the Nginx container, which will receive HTTPS traffic from Azure's front end and forward it to your internal services over HTTP.
    3. ABP Application Configuration

      • Set the App:SelfUrl and other relevant URLs in each app to match the public paths (e.g., https://www.example.com/admin for Blazor Admin).
      • Update CORS and redirect URIs to match the new paths.

    Notes

    • All endpoints will share the same domain and SSL certificate.
    • Path-based routing is handled by the reverse proxy.
    • You do not need multiple App Services or subdomains.

    Example Reference

    • Official ABP Docker Compose deployment guide:
      • https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/deployment-docker-compose

    This approach is fully supported and aligns with ABP and Azure best practices for containerized multi-app hosting.


    Sources:

    • https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/deployment-docker-compose

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    devchase321 created

    I have tried these steps but I am still unable to resolve the problem. Please advise.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Which step did you encounter a problem with?

    What is the problem?

    Thanks.

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    Which step did you encounter a problem with?

    What is the problem?

    Thanks.

    Hi

    I have followed the ABP documentation for Docker Compose deployment: https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/deployment-docker-compose?UI=Blazor&DB=EF&Tiered=Yes I have successfully deployed a single application to an Azure App Service for Containers. I want to deploy multiple applications in a single Azure App Service using Docker Compose. Could you please guide me on how to host multiple applications in a single azure App Service using docker compose?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Using Nginx as a reverse proxy is the simplest solution. You can try following the steps mentioned above. If you encounter any issues, please feel free to let us know.

    Thanks.

    https://abp.io/support/questions/9968/How-to-host-multiple-sites-on-single-Azure-web-app-for-Containers-using-docker-compose#answer-3a1ccad4-7745-6f9b-77aa-160e3807f6e6

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    Using Nginx as a reverse proxy is the simplest solution. You can try following the steps mentioned above. If you encounter any issues, please feel free to let us know.

    Thanks.

    https://abp.io/support/questions/9968/How-to-host-multiple-sites-on-single-Azure-web-app-for-Containers-using-docker-compose#answer-3a1ccad4-7745-6f9b-77aa-160e3807f6e6

    Hi I am using sperate app service for each application, but I am getting below error :

    36307Z RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable 2025-10-06T18:48:49.9236339Z ---> System.AggregateException: One or more errors occurred. (Connection failed, host 127.0.0.1:5672) 2025-10-06T18:48:49.9236367Z ---> RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed, host 127.0.0.1:5672 2025-10-06T18:48:49.9236392Z ---> System.Net.Sockets.SocketException (111): Connection refused 2025-10-06T18:48:49.9236459Z at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) 2025-10-06T18:48:49.9236490Z at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236521Z at RabbitMQ.Client.Impl.SocketFactory.ConnectUsingAddressFamilyAsync(IPEndPoint endpoint, Func2 socketFactory, AddressFamily family, TimeSpan connectionTimeout, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236545Z --- End of inner exception stack trace --- 2025-10-06T18:48:49.9236575Z at RabbitMQ.Client.Impl.SocketFactory.ConnectUsingAddressFamilyAsync(IPEndPoint endpoint, Func2 socketFactory, AddressFamily family, TimeSpan connectionTimeout, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236605Z at RabbitMQ.Client.Impl.SocketFactory.OpenAsync(AmqpTcpEndpoint amqpTcpEndpoint, Func2 socketFactory, TimeSpan connectionTimeout, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236633Z at RabbitMQ.Client.Impl.SocketFrameHandler.CreateAsync(AmqpTcpEndpoint amqpTcpEndpoint, Func2 socketFactory, TimeSpan connectionTimeout, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236665Z at RabbitMQ.Client.ConnectionFactory.CreateFrameHandlerAsync(AmqpTcpEndpoint endpoint, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236697Z at RabbitMQ.Client.EndpointResolverExtensions.SelectOneAsync[T](IEndpointResolver resolver, Func3 selector, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236733Z --- End of inner exception stack trace --- 2025-10-06T18:48:49.9236761Z at RabbitMQ.Client.EndpointResolverExtensions.SelectOneAsync[T](IEndpointResolver resolver, Func3 selector, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236790Z at RabbitMQ.Client.ConnectionFactory.CreateConnectionAsync(IEndpointResolver endpointResolver, String clientProvidedName, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236814Z --- End of inner exception stack trace --- 2025-10-06T18:48:49.9236842Z at RabbitMQ.Client.ConnectionFactory.CreateConnectionAsync(IEndpointResolver endpointResolver, String clientProvidedName, CancellationToken cancellationToken) 2025-10-06T18:48:49.9236869Z at Volo.Abp.RabbitMQ.ConnectionPool.GetConnectionAsync(String connectionName, ConnectionFactory connectionFactory) 2025-10-06T18:48:49.9236893Z at Volo.Abp.RabbitMQ.ConnectionPool.GetAsync(String connectionName) 2025-10-06T18:48:49.9236917Z at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()

    Thanks

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 02, 2025, 08:00