i am new to nginx and I am not sure is this normal behavior...
Here is the lib I am using: https://github.com/jwilder/nginx-proxy
I will explain here what I trying to accomplish...
I have 2 additional services service1
and service2
those services are simple node.js images with API endpoints
service1 have routes:
- service1/api/first
- service1/api/second
`
`
service2 have routes:
- service2/api/third
- service2/api/fourth
`
So is possible to be able to access this services from same host, like this:
localhost/service1/api/first
localhost/service2/api/third
?
I tried like this:
My `docker-compose.yml` file:
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
whoami:
image: jwilder/whoami
environment:
- VIRTUAL_HOST=whoami.local
service1:
image: mynode:1.1
volumes:
- .:/app
restart: always
environment:
- VIRTUAL_HOST=service1.local
- VIRTUAL_PORT=8080
service2:
image: mynodeother:1.2
volumes:
- .:/app
restart: always
environment:
- VIRTUAL_HOST=service2.local
- VIRTUAL_PORT=8081
Here is generated config file from command docker exec nginx-proxy cat /etc/nginx/conf.d/default.conf
:
http://pushsc.com/show/code/58f739790a58d602a0b99d22
Also when I visit localhost in browser I get:
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com.
Thank you for using nginx.