im trying to do a little lab with NGINX and PHP under Docker. the case is i have a little PHP page calle index_simple.php that is on the PHP container. the thing is im triying to redirect what i receive on the proxi under http://host:80/arso2021 and redirected to http://docker_container:80/index_simple for load the file. this actually is not working. The containers are connected on the same network as you can see on the Docker-compose.yml file.
version: '3.666666'
services:
db:
container_name: db
image: mysql:5.7
restart: always
environment:
# Nombre de la base de datos
MYSQL_DATABASE: 'axsodb'
# Usuario y password del SQL
MYSQL_USER: 'jdacostar'
MYSQL_PASSWORD: 'password1'
# ContraseƱa de root
MYSQL_ROOT_PASSWORD: 'password1'
ports:
- '3306:3306'
expose:
# abrimos el puerto 3306
- '3306'
web-php:
build:
context: ./php/
dockerfile: Dockerfile
depends_on:
- db
container_name: web-php
hostname: arso20212
volumes:
- ./html:/var/www/html/
ports:
- 5000:80
networks:
- lab_network
nginx:
container_name: reverse_proxy
image: nginx:alpine
ports:
- 80:80
- 443:443
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./html:/var/www/html/
networks:
- lab_network
networks: lab_network: name: lab_net driver: bridge
and the nginx.conf file.
events{
}
http{
server{
listen 80;
location /arso2021 {
porxy_pass http://172.0.0.3:5000/index_php.php;
}
}
}
also on the logs of the nginx i see that always is trying to get the "index_file.php" from his internal storage not from the php server.
also if i change the location from /arso2021 to /index_simple works fine also if i use the rewrite 301 i can load the file index_php.php with the wanted path but the php was not executed.
could someone give me a hand please.
thanks in adavance
kind regards