I have an Alfresco Share application and multiple custom applications that are all connected. Now I have to connect them all with the nginx proxy server so that all of them run on port 80. I am experiencing 404 error with my custom apps (share runs fine). All of the applications are docker containers.
My Dockerfile (for nginx):
FROM nginx:latest
ARG SHARE_HOST
ARG APP_HOST
COPY default.conf.template /etc/nginx/conf.d/default.conf.template
RUN envsubst '${SHARE_HOST}, ${APP_HOST}' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
My default.conf.template
server {
listen 80 default_server;
server_name example.com;
location /app {
proxy_pass http://${APP_HOST}:3000;
}
location / {
proxy_pass http://${SHARE_HOST}:8080;
}
}
My docker build command:
docker build --build-arg SHARE_HOST=alfresco-share --build-arg APP_HOST=app_container -t documan-nginx-redirect .
alfresco-share and app_container are the names of the running containers
All containers run fine and they are all in the same network. Nginx container is also in the same network.
Share application loads fine (the URL is localhost/share/page/admin/dashboard as expected), but when i type localhost/app in the URL, it throws 404 error.
What am I doing wrong?
The solution was: