My server http://127.0.0.1:5438/api provides the api.
The nginx configuration works fine if I'm not using the docker.
server {
listen 80;
server_name 127.0.0.1;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~/api/ { proxy_pass http://127.0.0.1:5438/api/; }
}
If I'm using docker, the nginx configuration is not working.
sudo docker run \
-d -p 80:80 \
-v /usr/share/nginx/html:/usr/share/nginx/html \
-v /etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro \
-v /usr/share/nginx/html/nginx.conf:/etc/nginx/sites-enabled/nginx.conf \
nginx
So how to access host's 5438 port in docker nginx?