Docker Symfony APIs deployed on host cannot find his resources after Apache2 ProxyPass configuration

I am not sure this the best practices for the project, so be kind !

Environment:

On my laptop for the simulation (Ubuntu 20.4), but this is the same interactions on a remote server.

I have 2 distinct Symfony APIs (ApiPlatform), api1 and api2 running with docker-compose so 6 containers (api1_php-fpm, api1_nginx, api1_mariadb, api2_php-fpm, api2_nginx, api2_mariadb).

I have one server host with an Apache Server that redirect connections via ProxyPass /etc/apache2/apach2.conf:

...
# API 1
ProxyPass /api1 http://127.0.0.1:8787
ProxyPassReverse /api1 http://127.0.0.1:8787

# API 2
ProxyPass /api2 http://127.0.0.1:8989
ProxyPassReverse /api2 http://127.0.0.1:8989

Practice:

When the APIs are docker-compose up, I can contact them via http://localhost:8787/api and http://localhost:8989/api thanks to docker configuration ports.

My wish is to contact the APIs with the specific URLs defined in the apache2.conf : http://localhost/api1/api or http://localhost/api2/api.
But they cannot find the correct path to their resources (see below).

Symfony error due to proxypass

What is the config I have to change ? Apache Host, Apache in docker php-fpm, Nginx in docker nginx ?

Thanks for reading.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *