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.


32 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

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Have you added the RabbitMQ service to your Docker file?

    Thanks.

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    Have you added the RabbitMQ service to your Docker file?

    Thanks.

    Hi No. Can you please provide details to add RabbitMQ service? When I click on the login button in the Blazor application, it redirects to the same URL instead of navigating to the authentication (Auth) URL. Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    services:
      rabbitmq:
        container_name: rabbitmq
        image: rabbitmq:3.12.7-management-alpine
        ports:
          - "15672:15672"
          - "5672:5672"
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try to use a subdomain instead of a sub-app?

    https://www.example.com → Web Public

    https://admin.example.com/ → Blazor Admin

    https://api.example.com/ → API

    https://auth.example.com/ → AuthServer

  • User Avatar
    0
    devchase321 created

    [maliming] said: Can you try to use a subdomain instead of a sub-app?

    I have created separate Azure App Services (for containers) for each application.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok, using a subdomain for each app will be fine.

    Thanks.

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    Can you try to use a subdomain instead of a sub-app?

    https://www.example.com → Web Public

    https://admin.example.com/ → Blazor Admin

    https://api.example.com/ → API

    https://auth.example.com/ → AuthServer

    Hi

    When I click on the login button in the Blazor application, it redirects to the same URL instead of navigating to the authentication (Auth) URL.

    I have added subdomain but it is not working. Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    it redirects to the same URL instead of navigating to the authentication (Auth) URL.

    What is the current redirect URL?

    https://admin.example.com/Account/Login ?

    Thanks.

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    it redirects to the same URL instead of navigating to the authentication (Auth) URL.

    What is the current redirect URL?

    https://admin.example.com/Account/Login ?

    Thanks.

    Hi

    This is the current redirect URL: https://admin.example.com/Account/Login same for public application https://example.com/Account/Login

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share your public and Blazor module C# files to liming.ma@volosoft.com?

    Thanks.

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    Can you share your public and Blazor module C# files to liming.ma@volosoft.com?

    Thanks.

    Hi I have sent the files to the email.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Both Blazor and PublicWeb are using oidc as the default challenge scheme.

    When you click login, it will redirect to https://admin.example.com/Account/Login and then redirec to authserver website login page.

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    Both Blazor and PublicWeb are using oidc as the default challenge scheme.

    When you click login, it will redirect to https://admin.example.com/Account/Login and then redirec to authserver website login page.

    Hi

    But right now it's not working? Can you please provide solution?

    thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Can you share a GIF?

    Thanks.

  • User Avatar
    0
    devchase321 created

    [maliming] said: Can you share a GIF?

    Thanks.

    Hi

    thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    There is an exception during login.

    Can you share the logs.txt of admin website?

    liming.ma@volosoft.com

    Thanks

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    There is an exception during login.

    Can you share the logs.txt of admin website?

    liming.ma@volosoft.com

    Thanks

    I have sent it

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Your auth returns an error.

    Does it have such code in the auth website startup module?

    app.Use(async (ctx, next) =>
    {
        ctx.Request.Scheme = "https";
        await next();
    });     
    

    Thanks.

  • User Avatar
    0
    devchase321 created

    [maliming] said: hi

    Your auth returns an error.

    Does it have such code in the auth website startup module?

    app.Use(async (ctx, next) => 
    { 
        ctx.Request.Scheme = "https"; 
        await next(); 
    });      
    

    Thanks.

    No, I have not added any such code in the auth website's startup module.

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 27, 2025, 08:34