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

Поделиться
HTML-код
  • Опубликовано: 11 сен 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

Комментарии • 55

  • @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: ruclips.net/video/TNwCGttYrlM/видео.html
    Or if you want to install Nginx take a look at this: ruclips.net/video/eVmUqh_HMKA/видео.html

    • @noeljose
      @noeljose 3 года назад

      You saved my day bro, THX

  • @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

  • @Bodybuilder900ml
    @Bodybuilder900ml 2 года назад +1

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

    • @TateA
      @TateA  2 года назад

      Glad to hear it!

  • @MrAnarguliyev
    @MrAnarguliyev 4 года назад +1

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

  • @course1ne
    @course1ne Год назад +1

    Thanks man. Finally a video on this that works

    • @TateA
      @TateA  Год назад

      Glad it helped

  • @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!

  • @abrahaocamelobrandao
    @abrahaocamelobrandao 4 года назад +2

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

  • @PavleStojanovic
    @PavleStojanovic 4 года назад +1

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

  • @gabrieloforti
    @gabrieloforti 8 месяцев назад

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

  • @user-ho9tv5db2p
    @user-ho9tv5db2p 11 месяцев назад +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?

  • @khanniyaz8
    @khanniyaz8 3 года назад +1

    Very well explained brother!

  • @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.

  • @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

  • @user-it8yt8se7i
    @user-it8yt8se7i 4 года назад

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

  • @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?

  • @jaebleds8861
    @jaebleds8861 4 года назад +1

    Awesome vid 👍

  • @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 !

  • @BradleyHerbst
    @BradleyHerbst 4 года назад +1

    Great video thanks!!

  • @perfect.stealth
    @perfect.stealth 3 года назад

    Thanks for your great tutorial.

  • @leonfrolow
    @leonfrolow Год назад

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

  • @warrenarnoldmusic
    @warrenarnoldmusic 3 месяца назад

    Thanks so much

  • @pavlospilakoutas
    @pavlospilakoutas 4 года назад +1

    Thx man 👍

  • @activelinestories1
    @activelinestories1 3 года назад +1

    Thanks for the video

    • @TateA
      @TateA  3 года назад

      No problem!

  • @orazwepayew4942
    @orazwepayew4942 8 месяцев назад

    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?

  • @shripadhegde9389
    @shripadhegde9389 3 года назад +1

    Super... Subscribed

    • @TateA
      @TateA  3 года назад

      Thanks and welcome

  • @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.

  • @tonyg2973
    @tonyg2973 3 года назад +1

    you are awesome!!!

    • @TateA
      @TateA  3 года назад

      Thanks you, glad to help.

  • @mr.craftminecrafttecnicoym999
    @mr.craftminecrafttecnicoym999 5 лет назад +4

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

  • @LordAlexanderArgr
    @LordAlexanderArgr 3 года назад

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

  • @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.

  • @antoniosergiodemoura
    @antoniosergiodemoura 3 года назад

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

  • @felipecosta2483
    @felipecosta2483 3 года назад

    Me salvou haha valeuuu

  • @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

  • @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

  • @richardayuyang632
    @richardayuyang632 4 года назад

    How to do it in https?

  • @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.

  • @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/;
    }
    }

  • @randomVidsandMusic
    @randomVidsandMusic 5 лет назад

    Nvm solved

  • @maowao
    @maowao 5 лет назад +1

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