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
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
You saved my day bro, THX
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!
Same here. This guy is a legend
Solid video!!!! Exactly what I was looking for. Your diagram is on point!
Glad to hear it!
Greetings from Azerbaijan! The video really amazing and helpful. Thanks a lot! Keep going!
Thanks man. Finally a video on this that works
Glad it helped
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!
Thanks for this video! You really helped me out. Keep going!
thanks a lot for this video :) exactly what i was looking for.
Did you have to change the /etc/hosts file for this setup? Thanks for the great video.
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?
Very well explained brother!
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.
Great work man, could you do docker and nginx with certbot and how to do on production like what things to make sure. Gg
Размещали проект на разных площадках в Европе. В итоге остановились в выборе на WELL-WEB NET, сделали предложение, от которого сложно было отказаться. Арендуем несколько серверов под балансировщики и реверс прокси. Квалифицированный технический персонал, работают оперативно. За несколько месяцев работы нареканий не возникло. Рекомендуем WELL-WEB если вам нужен стабильный канал и неограниченный трафик.
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?
Awesome vid 👍
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 !
Great video thanks!!
Thanks for your great tutorial.
insane how you're doing all of that in the terminal
Thanks so much
Thx man 👍
Thanks for the video
No problem!
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?
Super... Subscribed
Thanks and welcome
Can you tell me a little about how I would need to setup my public DNS records?
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.
you are awesome!!!
Thanks you, glad to help.
How can I add HTTPS to this? Thx in advise!
do u know how can i do that?
hello, how do I deny access to a certain internal IP of my network?
I am setting up with OSSN I am getting too many redirects with the setup you have shown.
Can you send me your config on discord: Tate#3597
So I can take a look.
Hi guys!!! I need to do it using SSL. I've tried and it doens't work. Can You help me. tks
Me salvou haha valeuuu
so the A record must be of the nginx servers IP right?
Can I reverse proxy any website on my domain?
if you own the site
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
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.
@@TateA one more than one port so we have two or more nginx daemons running on the same.machine
How to do it in https?
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.
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.
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/;
}
}
Nvm solved
Thanks for this video! You really helped me out. Keep going!