nginx/apache redirection for output port on docker container on vps nginx/apache redirection for output port on docker container on vps nginx nginx

nginx/apache redirection for output port on docker container on vps


Previous answers probably covers most of the issues, especially if there were redirection problems of your domain name.

In order to be fully portable and use all the possibilities of docker, my recommendation would be to used the Nginx official docker image and make it the only one accessible from the outside (with the opening of ports) and use the --link to manage connectivity between your Nginx containers and your other containers.

I have done that in similar situation which works pretty well. Below is a tentative translation of what I have done to your situation.

You start your share latex container without specifying any external port :

docker run -d \  -v ~/sharelatex_data:/var/lib/sharelatex \  --name=sharelatex \  sharelatex/sharelatex

You prepare an nginx conf file for your shareLatex server that you place in $HOME/nginx/conf that will look like

upstream sharelatex {     # this will refer to the name you pass as link to the nginx container     server sharelatex; }server {        listen 80;        server_name tools.sebastienreycoyrehourcq.fr;        location  ^~ / {              proxy_pass http://sharelatex/;        }}

You then start your nginx docker container with the appropriate volume links and container links :

docker run -d --link sharelatex:sharelatex --name NginxMain -v $HOME/nginx/conf:/etc/nginx/sites-available -v -p 80:80 kekev76/nginx

ps : this has been done with our own kekev76/nginx image that is public on github and docker but you can adapt the principle to the official nginx image.


nginx-proxy (https://github.com/jwilder/nginx-proxy) and then running sharelatex with VIRTUAL_HOST set to tools.sebastienreycoyrehourcq.fr should be enough to get this working.

e.g.

docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy

followed by

docker run -d \-e VIRTUAL_HOST=tools.sebastienreycoyrehourcq.fr \-v ~/sharelatex_data:/var/lib/sharelatex \-p 5000:80 \--name=sharelatex \sharelatex/sharelatex


The subdomain tools.sebastienreycoyrehourcq.fr is not configured properly. It does not resolve to any IP address which is the reason it does not work.

After you configure your subdomain, you can run the sharelatex container on port 80 with this command:

docker run -d \  -v ~/sharelatex_data:/var/lib/sharelatex \  -p 80:80 \  --name=sharelatex \  sharelatex/sharelatex

This way you can access the app at http://tools.sebastienreycoyrehourcq.fr