Configure a Docker Nginx Reverse Proxy Image and Container

  Рет қаралды 89,134

Cameron McKenzie

Cameron McKenzie

2 жыл бұрын

Here's a quick tutorial on how to dockerize Nginx and create an Nginx reverse proxy Docker image.

Пікірлер: 46
@MrBrackets
@MrBrackets Жыл бұрын
great video and good explanation, thank you!
@lahbaeil
@lahbaeil 5 ай бұрын
Simple, concise and straight to the point. Thank you sir, a great video!
@cameronmcnz
@cameronmcnz 5 ай бұрын
Thanks for watching! I've been criticized for not talking about security or performance or other things, but I figure smart people just want to get it working, and once it's working, they can figure out the details. Keeps these videos short and to the point. Having said that, make sure you harden your proxies before deployment!
@lucasrudyson4694
@lucasrudyson4694 Жыл бұрын
me salvou demais, por causa do seu vídeo mudei o default e conseguir obter o objetivo necessário, PARABENS
@caramingo37
@caramingo37 9 ай бұрын
thank you, very useful
@Alphahydro
@Alphahydro 2 жыл бұрын
I'm trying to accomplish something similar via proxy manager, considering you can't indicate sub-directories in the proxy settings.
@phanhuy9474
@phanhuy9474 Жыл бұрын
thank you so much!
@yamamotoyamamoto3886
@yamamotoyamamoto3886 Жыл бұрын
Thank you so much!
@chind0na
@chind0na 5 ай бұрын
Omg. I was missing a slash after the :port/ Most times we miss a semicolon but I suppose with nginx, slashes can be culprits as well. Thank you
@cameronmcnz
@cameronmcnz 5 ай бұрын
This is what we must suffer through as developers. Countless hours lost from a semi-colon or a backslash. Glad you figured it out!
@chind0na
@chind0na 5 ай бұрын
@@cameronmcnz and the worst in that nginx -t says All is well. SMH 🤦‍♂️
@alirahimi4746
@alirahimi4746 6 ай бұрын
thanks a lot, i have had some cors errors with my app and now their are gone! thanks a lot
@cameronmcnz
@cameronmcnz 6 ай бұрын
Super glad I could help!
@caskraker
@caskraker 8 ай бұрын
Liked to cee you do a wonkle xced variance next.
@cameronmcnz
@cameronmcnz 8 ай бұрын
I'll put it on the list!
@caskraker
@caskraker 8 ай бұрын
@@cameronmcnz trankz!
@noneofyourconcern4566
@noneofyourconcern4566 Жыл бұрын
Hmm, i was hoping this solved what I am trying to do, but i already get stuck that my system insists that there is no directory /etc/nginx/conf.d/ :-(
@Miguel-pe
@Miguel-pe 9 ай бұрын
When I mispeel in the CLI, the ctrl+t swaps the characters before and after where the cursor is.
@cameronmcnz
@cameronmcnz 6 ай бұрын
That is a pro tip!
@MontxoCaqueta
@MontxoCaqueta 4 ай бұрын
CONGRATULATIONS, VERY GOOD VIDEO. I have a question how I could do it with docker compose by creating a letsencrypt container to make the https certificates and view them through no-ip. Could you please advise me?
@cameronmcnz
@cameronmcnz 4 ай бұрын
Oh boy, you're are playing this docker compose game on expert level! I'm not sure if I can answer that with certainty, as I always get blocked with SSL connections and I haven't used letsencrypt. Maybe ask on stackoverflow and tag me? I'd love to see what the experts have to say!
@lifetillhope5733
@lifetillhope5733 Жыл бұрын
thanks. But i have question, is this app is running on another container or in our system.? What if this app run on another container just like tomcat etc?
@choahjinhuay
@choahjinhuay Жыл бұрын
It's running in a container.
@KoljaMineralka
@KoljaMineralka Жыл бұрын
how do you rotate ssl certificates while on docker using certbot ?
@taiwoesoimeme2383
@taiwoesoimeme2383 2 ай бұрын
Nice one. Just curious ? Is this cp from host to container permanent or ephemeral ? will the copied file still be there if the containers is restarted ?
@cameronmcnz
@cameronmcnz 2 ай бұрын
If the container is stopped and started the file remains there. However, if the container is stopped and deleted, and a new instance of the image is run, the new instance/container will not have the file. If you want to make the change permanent you can take a snapshot of the Docker image with the docker commit command. All containers run off that new image will have the file in it. Lots of options!
@taiwoesoimeme2383
@taiwoesoimeme2383 2 ай бұрын
@@cameronmcnz really appreciate your feedback
@washaw67
@washaw67 7 ай бұрын
Can I use this setup up with Nginx to force all client traffic to https if the backend application is not encrypted? Thx
@cameronmcnz
@cameronmcnz 6 ай бұрын
Yes
@romans7319
@romans7319 Жыл бұрын
Thanks
@user-ui8my9zs7o
@user-ui8my9zs7o 4 ай бұрын
How would i go about doing this for 2 containers that want to listen on port 80?
@cameronmcnz
@cameronmcnz 4 ай бұрын
You'd have to invent your own new operating system to do that, which might be a lot of effort. Even in 2024, computers really only allow one process per port. You can't have two containers fighting it out for port 80. You could put all your apps in one container in different subfolders and run it all on port 80. Or, you could run one on port 80, another on port 81, and have a reverse proxy in front spray requests to them. Similarly, Kubernetes can create a 'service' that routes requests through one port to other ports behind the scenes. Point is, your problem isn't a new one. It's one that's dogged admins since the dawn of time. But there are strategies out there. Does that make sense?
@user-mk1xr2gj7k
@user-mk1xr2gj7k Жыл бұрын
What if, the application is running at :8080/. What I want is configure the nginx reverse-proxy such that if I request localhost/example; it redirects to the application running on port 8080. I have tried location /example and proxy_pass :8080/; But it is not working. Any help?
@alext2k3
@alext2k3 Жыл бұрын
You've probably already figured this out, but ill comment for anyone else who has trouble Modify the docker run command to bind the container port 8080 to the desired host machines port. In this case I'm using port 80 "sudo docker run -d --name nginx-base -p 80:8080 nginx:latest" This is what my location block looks like for reference location / { proxy_pass {ipaddress}:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }
@zapbeeblebrox1053
@zapbeeblebrox1053 Жыл бұрын
curious. why are you running all the commands with sudo?
@ricko13
@ricko13 Жыл бұрын
because as you can see it throws an error "got permission denied"
@zapbeeblebrox1053
@zapbeeblebrox1053 Жыл бұрын
@@ricko13 if you install and set it up correctly it does not do that. As you can see.... this WAS supposed to be a tutorial and one would expect it to be properly installed
@drm8164
@drm8164 9 ай бұрын
0:48 i can not display localhost message -> not working please help
@lemague
@lemague 10 ай бұрын
you only configured it for a single path, its not a full reverse proxy xd
@arvindrawat9522
@arvindrawat9522 Жыл бұрын
Can you please provide code
@blender_wiki
@blender_wiki 5 ай бұрын
I know any video requires a huge amount of work but this displays bad and insecure practice. For the safety of your server don't do it this way.
@cameronmcnz
@cameronmcnz 5 ай бұрын
People who come to a 10 minute video on configuring nginx as a reverse proxy are looking to get things set up quickly. Nobody in their right mind would think that a 10 minute video would address every production level vulnerability and enterprise wide penetration issue. People who come to a video like this just want to get things up and running to see how it works. People are smart enough to put the proper measures in place once they figure out how things work. If people aren't that smart, they won't be in a position where they'll be configuring nginx as a reverse proxy in a production environment. For the most part, my viewers are pretty smart.
@jujamix6895
@jujamix6895 5 ай бұрын
Exactly, it helped me understand this concept of NGINX, but obviously there's more if you want to setup something secure, you did a great job explaining the basics of this man, thanks.@@cameronmcnz
@JoaoPaulo-ox6pr
@JoaoPaulo-ox6pr 27 күн бұрын
can i use a docker service name instead of an ip address? i was supposed to do a reverse proxy to connect my front-end(React) to my back-end(node.js/express), both running in docker via docker compose, since i can't use the service name on the front-end fetch calls cause the request is send by the browser, so docker cannot parse the service name to an ip address in this situation, how could i fix this?
Is this the BEST Reverse Proxy for Docker? // Traefik Tutorial
21:57
Christian Lempa
Рет қаралды 504 М.
Apache vs NGINX
7:53
IBM Technology
Рет қаралды 267 М.
Useful gadget for styling hair 🤩💖 #gadgets #hairstyle
00:20
FLIP FLOP Hacks
Рет қаралды 5 МЛН
Does size matter? BEACH EDITION
00:32
Mini Katana
Рет қаралды 20 МЛН
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 181 МЛН
Iron Chin ✅ Isaih made this look too easy
00:13
Power Slap
Рет қаралды 35 МЛН
The NGINX Crash Course
50:53
Laith Academy
Рет қаралды 479 М.
Configure NGINX as a Reverse Proxy
16:43
NGINX
Рет қаралды 207 М.
Quick and Easy Local SSL Certificates for Your Homelab!
12:08
Wolfgang's Channel
Рет қаралды 723 М.
Reverse proxy nginx letsencrypt tutorial
17:12
Christian Lempa
Рет қаралды 116 М.
Запуск Nginx в контейнере Docker
20:55
Поддержка Сайтов :: Метод Лаб
Рет қаралды 13 М.
Proxy vs Reverse Proxy (Real-world Examples)
5:17
ByteByteGo
Рет қаралды 530 М.
Docker and Nginx Reverse Proxy
31:32
Wes Doyle
Рет қаралды 114 М.
Useful gadget for styling hair 🤩💖 #gadgets #hairstyle
00:20
FLIP FLOP Hacks
Рет қаралды 5 МЛН