I have a local Nginx
installation that uses a custom config file to route different services and a web application to a single port.
The Nginx
configuration file looks something like:
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /api/login {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server %host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8181;
client_max_body_size 10M;
}
location /api/accountopening {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server %host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8282;
client_max_body_size 10M;
}
...
I am trying to do the same thing with Docker
and the Nginx
official image in DockerHub, but I haven't been able to.
In their documentation they say I should do something like:
docker run --name cor-nginx \
-v ~/dev/nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro \
-d \
-p 8080:80 nginx
to create a volume and specify a custom config file but no results so far.
Has anyone done anything similar ?
Thanks a lot in advance!