I'm a linux noob in admin of docker container using apache or nginx on VPS.
I use an OVH classic Vps (4go ram, 25Go SSD) with already installed image of ubuntu 15.04 + docker.
Install of docker container is really easy, and in my case i install without problem the image sharelatex.
docker run -d \
-v ~/sharelatex_data:/var/lib/sharelatex \
-p 5000:80 \
--name=sharelatex \
sharelatex/sharelatex
Site is accessible on IP of the VPS at http://51.255.47.40:5000
port show that site work without any problem.
I have already a sub domain (tools.sebastienreycoyrehourcq.fr) configurated to go on the server ip vps (51.255.47.40
routed to External in webfaction panel ), not working, don't understand why.
I install an apache server on 51.255.47.40
, but i suppose the best option is probably to install a docker image of nginx or apache ? Can you advice me on this point ? And after that, how can i redirect to 5000
port of the docker image on a classic 80 port of apache or nginx linked to my subdomain ?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With