Answer the question
In order to leave comments, you need to log in
Deploy multiple apps on one droplet?
I'm immersed in the topic of deployment. I understand that you can have several applications on one droplet, each of which will be tied to its own domain. So far I don’t quite understand how it works - after all, there is only one external ip, the port too.
I assume this is all configurable in nginx? If so, does anyone have a good guide on setting it up? I watched enough lessons, I set it up myself about 10 times, but in my head it still remains magic and there is no understanding of what and why.
Can Nginx run in a container too? For two applications will there be one container with nginx or for each application? In general, I'm very noob in devops and I want to fix it)
Answer the question
In order to leave comments, you need to log in
As an option:
nginx on the main system:
./nginx/sites-enabled/site1.conf:
{
listen 80;
server_name site1.example.org;
location / {
proxy_pass: http://127.0.0.1:8081;
}
}
{
listen 80;
server_name site2.example.org;
location / {
proxy_pass: http://127.0.0.1:8082;
}
}
nginx:
volumes:
- ./:/opt/site1-root
- ./config/nginx:/etc/nginx/conf.d
ports:
- "0.0.0.0:8081:80"
{
listen 80;
local / {
root /opt/site1-root;
}
}
nginx:
volumes:
- ./:/opt/site2-root
- ./config/nginx:/etc/nginx/conf.d
ports:
- "0.0.0.0:8082:80"
{
listen 80;
local / {
root /opt/site2-root;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question