Тёмный

Run Multiple Site from one IP with reverse proxy Nginx 

Juan Nadal
Подписаться 1,1 тыс.
Просмотров 107 тыс.
50% 1

How to run multiple sites on one web-server using Nginx by creating a virtual host.
Also shows how to host dynamic content using port 8080 and 8081
Free Trial on Digital Ocean: m.do.co/c/8add...
Helpful sites:
www.digitaloce...
nginx.org/en/do...
----------------------------------------------------------------------------------------------
commands used during video:
sudo apt install nginx
---show content in "site enable"
unlink default
-- create new conf file in conf.d
newsite.conf
--- past server block into .conf file
server {
listen 80 default_server;
server_name yourdomain1.xyz www.yourdomain1.xyz;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass localhost:8081;
}
}
server {
listen 80;
server_name yourdomain2.info www.yourdomain2.info;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass localhost:8080;
}
}
nginx -t
systemctl reload nginx
systemctl status nginux

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 50   
@kahelsoro
@kahelsoro 3 года назад
Thanks ma man! This really helped, other guides add a lot of information that it becomes overwhelming
@vishalparkar
@vishalparkar 2 года назад
Thank you very much ! Subscribed and liked !! One query though. at 5:56 did you paste the server block for the second site just below the first or just replaced the first with the second ? If this is the second case, then how did both the urls work if the config for the first is replaced ?
@tultr
@tultr 3 года назад
wow I went many years never knowing that sudo stands for Super User DO. Thanks for the tutorial!
@rukasu01
@rukasu01 2 года назад
Nah bruh it means Shut Up and Do as Ordered
@tarvinder91
@tarvinder91 3 года назад
There are some things which are not really clear else there is so much to learn from this video
@logicawe
@logicawe 4 года назад
Great video, thanks for sharing 👍. I am much more familiar with Apache so it was neat to see the equivalent on Nginx.
@georgesmith3022
@georgesmith3022 3 года назад
this is how to proxy to different sites based on server name. This means you should run now nginx plus two more servers. If you want to run multiple servers on the same server you just need a different root folder and remove the proxy commands
@FirstLast-hm8oz
@FirstLast-hm8oz 3 года назад
Could you please provide an example ?
@dipanshuc
@dipanshuc 4 года назад
Thanks man! Your video was very informative.
@tanchienhao
@tanchienhao 2 года назад
at 6:01 how come you replaced the balckjack website? and also im curious what happened to the at 2:07. thank you for the great video! :D
@RahulYadavhacker
@RahulYadavhacker 3 года назад
You saved my so much time. Thank you sooo much
@MuhammadAmir-ff8wl
@MuhammadAmir-ff8wl 3 года назад
Thanks Man you solve my problem
@ahsanraza4762
@ahsanraza4762 4 года назад
Thank you for posting such great content. However, can we do the same thing by using IIS ?
@techsapphire
@techsapphire 4 года назад
Can I reverse proxy any website on my domain?
@srijansingh8272
@srijansingh8272 4 года назад
default server is working but another one is not working. Can anyone help me?
@Scuffy
@Scuffy 3 года назад
Hello Im wondering how to host as https with nginx do you know how?
@blackestwhite
@blackestwhite 5 лет назад
thanks man!
@JamesKaneF
@JamesKaneF 3 года назад
502 Bad Gateway How do I fix that?
@colorghost
@colorghost 2 года назад
Thank you! 😄
@azartheen428
@azartheen428 3 года назад
hi... i need help from you iam working on java JSP page on the tomcat server i can access all post and get method in 80 port but not working in 443 what happens.. and what is the problem can you please explain me or fix this problem
@JuanNadal
@JuanNadal 3 года назад
You need to setup SSL for port 443
@azartheen428
@azartheen428 3 года назад
@@JuanNadal yes i did using cerbot... my question is why some functionality work in 80 not in 443
@StefTechSurfer
@StefTechSurfer 4 года назад
How about if you have Cloudflare in between?
@weiiswurst
@weiiswurst 4 года назад
Cloudflare doesn't care, works fine with it.
@nikhilsinha2191
@nikhilsinha2191 Год назад
to achive the think which he did earlier edit the listen to 8080 or 8081 in the /etc/nginx/sites-available/{yourfilename} to get the desired results as him
@angelthekind1595
@angelthekind1595 4 года назад
hi friend thanks for sharing! where did you store the index files of the site to bee on port 8081?
@RichardApplegate
@RichardApplegate 5 лет назад
Thank you so much! so much appericate you made this simple.....
@okenkhuman_logicbee
@okenkhuman_logicbee 4 года назад
I am trying to link multiole mqtt websockets on various domains... like e1.domain.com->mqtt1 e2.domain.com->mqtt2...etc Please acknowledge me
@brunobernard86
@brunobernard86 5 лет назад
also, does it block access to: IP:PORT ? e.g someone manually go to 157.230.151.33:8080
@vedprakash-zz6hb
@vedprakash-zz6hb 4 года назад
Yes Use empty host and return 444 e.g server { listen 80; server_name ""; return 444; } Here, the server name is set to an empty string that will match requests without the “Host” header field, and a special nginx’s non-standard code 444 is returned that closes the connection.
@luit.s
@luit.s 3 года назад
I have a TL-WDR4300 router with openwrt nginx-ssl, acme and duckdns. I am struggling to install a reverse proxy any one have ever try anything like this?
@PeterBatah
@PeterBatah 2 года назад
Thanks for sharing you time and experience with us. Quick question. Where does the content for the two sites reside? And would it require a folder for each of your sites?
@tanchienhao
@tanchienhao 2 года назад
they can reside anywhere they want as long as they are accessible on the ports. nginx simply redirects requests to the relevant ports. you can have a folder for each site for better organisation. hope this helps :)
@petertremblay3725
@petertremblay3725 2 года назад
@@tanchienhao I am confuse about the port change, i got 3 websites that i want to have on my vps and served by nginx so do i have to open new ports for each additional website? Thank for any help
@tanchienhao
@tanchienhao 2 года назад
@@petertremblay3725 yup two sites cannot run on the same port of the same computer
@petertremblay3725
@petertremblay3725 2 года назад
@@tanchienhao Thank i was confuse about that part since so many channel do thing differently! But if i set nginx as reverse proxy then more than 2 sites can be on same port correct?
@ariloguecom
@ariloguecom 3 года назад
do we need install bind9 to do this? (i know it's a noob question sorry about that :)
@lotusmojo
@lotusmojo 3 года назад
do you have the same for windows 10?
@diosmio2009
@diosmio2009 4 года назад
Thank you very much for the clear explanation
@masudrana1983
@masudrana1983 3 года назад
Thanks. Love this one.
@yugiohsc
@yugiohsc 4 года назад
You sound really similar to gotbletu! Thanks for the tutorial bro
@LOVEUNEO
@LOVEUNEO 4 года назад
Can you provide ssl certificate to both the sites from your Nginx?
@svampebob007
@svampebob007 3 года назад
yes, you just need to sign the ssl certificate with the correct domain name and add it to the config file, or you could use a CA that way you only need to singe a single certificate.
Далее
The NGINX Crash Course
50:53
Просмотров 489 тыс.
How to Setup a Reverse Proxy on Home Network
28:15
Просмотров 71 тыс.
100 Identical Twins Fight For $250,000
35:40
Просмотров 31 млн
Reverse proxy nginx letsencrypt tutorial
17:12
Просмотров 119 тыс.
Proxy vs Reverse Proxy (Real-world Examples)
5:17
Просмотров 564 тыс.
Apache vs NGINX
7:53
Просмотров 298 тыс.
Configure NGINX as a Reverse Proxy
16:43
Просмотров 216 тыс.
How to use Nginx  Reverse proxy for Multiple Servers
10:11
Apache Virtual Hosts
40:20
Просмотров 103 тыс.
Using Nginx to Host Multiple Websites on One Server
16:30
Китайский XRAY VPN - shadowsocks, VLESS
29:12