Muhammad Nawaz
Muhammad Nawaz

Reputation: 3

Is it possible to access both my Django project and Nginx Server on a single port forwarding?

My Django project is running on http://127.0.0.1:8000/ and Nginx Server is running on http://127.0.0.1:8080/

I want to access both on a single port forwarding (8081).

Host Django and Nginx on the same port on the windows server.

I've docker compose as:

version: '3' services: web: build: . command: sh -c "echo 'Making migrations ' && python manage.py makemigrations && echo 'Migrating...' && python manage.py migrate && echo 'Running server...' && python manage.py runserver 0.0.0.0:8000" volumes: - .:/code ports: - "8000:8000" restart: always nginx-allure: image: nginx container_name: nginx-allure ports: - "8080:80" volumes: - type: bind source: ./allure-reports target: /usr/share/nginx/html read_only: true restart: always

Upvotes: 0

Views: 129

Answers (1)

Bhavya Peshavaria
Bhavya Peshavaria

Reputation: 361

You cannot use both of them on the same port. However, what you can do is serve Nginx on port 8081 and redirect the requests for Django from Nginx to port 8080 of Django using proxy_pass.

Upvotes: 0

Related Questions