Advertisement
Sergio_Istea

nginx-proxy-deployer.sh

May 2nd, 2024
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.59 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Instalar docker
  4. #
  5.  
  6. apt update && apt install docker.io -y
  7.  
  8.  
  9. # Añadir usario a grupo docker
  10. #
  11. #
  12.  
  13. gpasswd -a $USER docker
  14.  
  15. # Crear red
  16.  
  17. docker network create nginx-proxy
  18.  
  19. # Desplegar nginx
  20. #
  21.  
  22. docker run -d -p 80:80 \
  23. --restart=always \
  24. --name nginx-proxy \
  25. -v /var/run/docker.sock:/tmp/docker.sock:ro \
  26. --network nginx-proxy \
  27. jwilder/nginx-proxy
  28.  
  29.  
  30. # apache2 test
  31. #
  32. docker run -d \
  33. --restart=always \
  34. --name apache2-proxy \
  35. --network nginx-proxy \
  36. -e VIRTUAL_HOST=nginx-proxy.test \
  37. ubuntu/apache2
  38.  
  39.  
  40. # final
  41. #
  42. echo "
  43. acceso http://nginx-proxy.test
  44. "
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement