R
R
RuslanSer2021-05-31 08:54:00
Apache HTTP Server
RuslanSer, 2021-05-31 08:54:00

How to connect docker port 8000 to apache port 80?

In general, there is a site in django and vue.
Django with vue will be placed in a container and the container will give everything on port 8000.

But the server already has apache which occupies port 80, and to access the site you need to access the port: test1.example.com:8000 (yes, everything will be with a subdomain ).

My main question:
(Ps, when I run docker-compose up, docker complains that port 80 is busy. It is busy with apache and it should be so, apache should not be disabled)
How can I "forward" docker port 8000 to apache port 80 . Yeah, it's possible through a proxy in the virtual host settings, but is it possible to do this in htaccess (it's just a condition, do it without getting into the virtual host config)?

And a side question:
If it is impossible to forward ports in this way, then will the following version of the site work be acceptable (?):
Since the site is written in vue and django, then I will simply compile vue and throw its files into the DocumentRoot where it will be picked up by apache and given to the user. Django will run in a docker container on its port 8000 and vue (not in the container) will access it on port 8000.
Is it acceptable when the frontend calls the backend which is located on a different port?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Volkov, 2021-06-01
@voleg4u

"proxy in virtual host settings"
Different processes cannot listen on the same port.
Therefore, Apache needs to add a new virtualhost and proxypass to docker:8000.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question