How to configure two apps over same domain

Hello everyone,

I have an environment with 3 containers and I also have a domain with my app in production.

I would like to implement mediawiki with the pattern address like

I tried to redirect any call for to my mediwiki container and it works, but the address changes to

This is my compose file:

  build: ./app
  command: python runserver
   - 8000:8000

  build: ./nginx
    - 80:80
    - 443:443

 build: ./wiki
   - 8080:80

And this is the nginx.conf

upstream example {
    server app:8000;

upstream wiki {
    server wiki:80;

server {

    listen 80;
    client_header_timeout 3000;
    client_body_timeout 3000;
    fastcgi_read_timeout 3000;
    client_max_body_size 32m;
    fastcgi_buffers 8 128k;
    fastcgi_buffer_size 128k;

    location / {
        proxy_pass http://example;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;

    location /static/ {
        alias /home/app/web/static/;

    location /wiki {
        proxy_pass http://wiki;
        rewrite ^/wiki(.*) /$1 break;

There is a way to configure it and stop showing its port address? What i’m missing? if there is a better way to do that, I’m open to suggestions.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


Your configuration looks correct actually.

What happens when you visit your IP address on port 80?

You can take a look at this answer here but your approach is also correct: