Nginx Reverse Proxy Set Up ( Multiple Server On The Same Port One IP )

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024
  • How to setup a reverse proxy with Nginx.
    CLI
    sudo nano /etc/nginx/sites-available/default
    ```
    server {
    listen 80;
    server_name HOST_NAME_OF_YOUR_SIT;
    location / {
    proxy_pass YOUR_SERVER_IP:SERVER_PORT;
    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;
    }
    }
    server {
    listen 80;
    server_name HOST_NAME_OF_YOUR_SITE;
    location / {
    proxy_pass YOUR_SERVER_IP:SERVER_PORT;
    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;
    }
    }
    ```
    sudo systemctl reload nginx
    Please like and subscribe!
    #TateA

ความคิดเห็น • 54

  • @TateA
    @TateA  5 ปีที่แล้ว +2

    Hi guys! Thank you for watching, and please don't forget to
    subscribe and like.
    If you need any help please leave a comment, I will try to help ASP.
    If you need help installing Apache take a look at this: th-cam.com/video/TNwCGttYrlM/w-d-xo.html
    Or if you want to install Nginx take a look at this: th-cam.com/video/eVmUqh_HMKA/w-d-xo.html

    • @noeljose
      @noeljose 3 ปีที่แล้ว

      You saved my day bro, THX

  • @Bodybuilder900ml
    @Bodybuilder900ml 2 ปีที่แล้ว +1

    Solid video!!!! Exactly what I was looking for. Your diagram is on point!

    • @TateA
      @TateA  2 ปีที่แล้ว

      Glad to hear it!

  • @course1ne
    @course1ne ปีที่แล้ว +1

    Thanks man. Finally a video on this that works

    • @TateA
      @TateA  ปีที่แล้ว

      Glad it helped

  • @rjmanhas-u8s
    @rjmanhas-u8s ปีที่แล้ว +1

    Hello i have an question. Is there an time you would need more nginx server to be able to load balance more r/s. like you have 2 nginx servers that get randomly picked from DNS and then they have sub servers they load balance to?

  • @numankaraaslan
    @numankaraaslan 4 หลายเดือนก่อน

    I did exactly the same but nginx strangely only redirecting to the first server block even if the domain name doesn't match. Why do you think it happens?

  • @PavleStojanovic
    @PavleStojanovic 4 ปีที่แล้ว +1

    thanks a lot for this video :) exactly what i was looking for.

  • @khanniyaz8
    @khanniyaz8 3 ปีที่แล้ว +1

    Very well explained brother!

  • @mr.craftminecrafttecnicoym999
    @mr.craftminecrafttecnicoym999 5 ปีที่แล้ว +4

    How can I add HTTPS to this? Thx in advise!

  • @akjwHTX
    @akjwHTX 5 ปีที่แล้ว +3

    Can you tell me a little about how I would need to setup my public DNS records?

    • @TateA
      @TateA  5 ปีที่แล้ว

      Are you trying to set up your own DNS Server? Most places that sell domain, will let you add records. You will need ( A ) record pointing to your External IP. If you are not DDoS protected, I highly recommend CloudFlare. They will DDoS protect one site for free. You will need to point your domain to there name servers, and add your DNS records there.

  • @leonfrolow
    @leonfrolow ปีที่แล้ว

    insane how you're doing all of that in the terminal

  • @BradleyHerbst
    @BradleyHerbst 4 ปีที่แล้ว +1

    Great video thanks!!

  • @pavlospilakoutas
    @pavlospilakoutas 4 ปีที่แล้ว +1

    Thx man 👍

  • @shripadhegde9389
    @shripadhegde9389 3 ปีที่แล้ว +1

    Super... Subscribed

    • @TateA
      @TateA  3 ปีที่แล้ว

      Thanks and welcome

  • @naturevibezz
    @naturevibezz 4 ปีที่แล้ว

    so the A record must be of the nginx servers IP right?

  • @techsapphire
    @techsapphire 4 ปีที่แล้ว

    Can I reverse proxy any website on my domain?

    • @TateA
      @TateA  4 ปีที่แล้ว

      if you own the site

  • @philsipad
    @philsipad 3 ปีที่แล้ว

    You wasted five minutes of your video explaining why one would want multiple servers on same port one IP when people who clicked on your video had ALREADY UNDERSTOOD WHY they wanted it because they clicked on for the TITLE of your video. That five minutes would've better spent on how to install Nginx in the first place which you did not at all explain.

    • @TateA
      @TateA  3 ปีที่แล้ว

      You would think. But I have people who have just have installed Nginx. And have no clue what that would even mean. So I have to cover every grounds.

  • @KylesYTU
    @KylesYTU 4 ปีที่แล้ว +1

    Great Video! I am fairly new to this, so will I have to change the port 80 on the web servers virtual host or can I just leave that? like for example in the header of the virtual host it has would I have to change the 80? also I changed the web server to 80.80.80.80, 80.80.81.81 that is manual, do I change this to automatic if I use a reverse proxy? sorry for so many questions, but for the reverse proxy server, in the router settings, do I have that server ip port forwarded to port 80? last question as of now (sorry again if I have more in the future) if I already have a website that hs an ssl certificate from cloudflare and I do the reverse proxy that you showed here, would it affect it at all because what you showed was only http and not https? Thanks! if you need me to clarify more, I will try my hardest to explain what I am asking. Thanks Again.

  • @orazwepayew4942
    @orazwepayew4942 9 หลายเดือนก่อน

    hello. if i add 2-3 servers from different locations after that can i create a vpn server? on that vpn server will be shown the other vps s location which i added before? for exmple in shadowrocked vpn when i make a subscription can i use it other vps servers location all together? could you please help?

  • @abrahaocamelobrandao
    @abrahaocamelobrandao 5 ปีที่แล้ว +2

    Thanks for this video! You really helped me out. Keep going!

  • @gabrieloforti
    @gabrieloforti 8 หลายเดือนก่อน

    Did you have to change the /etc/hosts file for this setup? Thanks for the great video.

  • @embersajt2593
    @embersajt2593 4 ปีที่แล้ว +2

    Hi!
    Thank you very much for your help!
    I watched tons of videos and I did the same thing as what they did, but none of them was helpful. And now I found you, and you've helped me a lot, your video is much shorter than others but has more information and it's more understandable than other's one.
    Thank you so much again, hope you're doing great today! :)
    See you later!

    • @helloitsjury
      @helloitsjury 4 ปีที่แล้ว

      Same here. This guy is a legend

  • @MrAnarguliyev
    @MrAnarguliyev 4 ปีที่แล้ว +1

    Greetings from Azerbaijan! The video really amazing and helpful. Thanks a lot! Keep going!

  • @warrenarnoldmusic
    @warrenarnoldmusic 3 หลายเดือนก่อน

    Thanks so much

  • @maowao
    @maowao 5 ปีที่แล้ว +1

    Thanks for this video! You really helped me out. Keep going!

  • @thatrandomguy9027
    @thatrandomguy9027 ปีที่แล้ว

    Great work man, could you do docker and nginx with certbot and how to do on production like what things to make sure. Gg

  • @ЕвгенийБакульский
    @ЕвгенийБакульский 4 ปีที่แล้ว

    Размещали проект на разных площадках в Европе. В итоге остановились в выборе на WELL-WEB NET, сделали предложение, от которого сложно было отказаться. Арендуем несколько серверов под балансировщики и реверс прокси. Квалифицированный технический персонал, работают оперативно. За несколько месяцев работы нареканий не возникло. Рекомендуем WELL-WEB если вам нужен стабильный канал и неограниченный трафик.

  • @sunilchandra9799
    @sunilchandra9799 5 ปีที่แล้ว

    I don't have domains to my remote servers. I'm tyring to do reverse proxy using IP address. So the url will nginxip:80/ this will hit my first remote server and give me response and nginxip:80/serv2 this will hit my second remote server and give me the response. The challenge here is the first one is working fine but when second isn'yt working as expected it is giving 404 while serving static files
    server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _localhost;
    location / {
    proxy_pass 10.1.2.9:8000/;
    }
    location /test/ {
    proxy_pass xxxxxxx:8000/;
    }
    }

  • @smorfnimda
    @smorfnimda 5 ปีที่แล้ว +1

    I am setting up with OSSN I am getting too many redirects with the setup you have shown.

    • @TateA
      @TateA  5 ปีที่แล้ว

      Can you send me your config on discord: Tate#3597
      So I can take a look.

  • @Afdac247
    @Afdac247 5 ปีที่แล้ว +1

    What is the version of the nginx reverse proxy. Should I also be able to do this from different ports on the same server, I mean i hope yes its 2019 lol

    • @TateA
      @TateA  5 ปีที่แล้ว

      I think the version was 1.14.0, not home right now so can't tell you exactly. And yes you can use this on different ports.
      Now if you what your reverse proxy to be on a different port, change this in the config:
      Listen 80
      To
      Listen 81
      e.g.

    • @Afdac247
      @Afdac247 5 ปีที่แล้ว

      @@TateA one more than one port so we have two or more nginx daemons running on the same.machine

  • @antoniosergiodemoura
    @antoniosergiodemoura 4 ปีที่แล้ว

    Hi guys!!! I need to do it using SSL. I've tried and it doens't work. Can You help me. tks

  • @LordAlexanderArgr
    @LordAlexanderArgr 3 ปีที่แล้ว

    hello, how do I deny access to a certain internal IP of my network?

  • @activelinestories1
    @activelinestories1 4 ปีที่แล้ว +1

    Thanks for the video

    • @TateA
      @TateA  3 ปีที่แล้ว

      No problem!

  • @daviddesimone6891
    @daviddesimone6891 4 ปีที่แล้ว

    Hi, I've watched so many videos on how to do this and never got it working. I followed this without any problems. Excellent video!

  • @tonyg2973
    @tonyg2973 3 ปีที่แล้ว +1

    you are awesome!!!

    • @TateA
      @TateA  3 ปีที่แล้ว

      Thanks you, glad to help.

  • @emersonsantos4372
    @emersonsantos4372 3 ปีที่แล้ว

    Mano, tu me ajudou muito com esse vídeo. entrei apenas para ver o que faltava de informação no meu arquivo de configuração. Grato !

  • @perfect.stealth
    @perfect.stealth 4 ปีที่แล้ว

    Thanks for your great tutorial.

  • @richardayuyang632
    @richardayuyang632 4 ปีที่แล้ว

    How to do it in https?

  • @felipecosta2483
    @felipecosta2483 3 ปีที่แล้ว

    Me salvou haha valeuuu

  • @randomVidsandMusic
    @randomVidsandMusic 5 ปีที่แล้ว

    Nvm solved