Configuring multiple applications on same port using nginx reverse proxy based on request urls

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ม.ค. 2025

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

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

    Even though this is an old tutorial but by far the best one to explain the concept of NGINX and its usage, very intuitive and helpful!

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

    You have explained it in the best manner, simple and effective is what one should call it.

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

    simple example, and easy to understand. Thank you. (But you can probably edit the video and remove all the beating around the bush till 5:25)

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

    Man i was searching for thins tutorial for weeks.

  • @diptayansil9104
    @diptayansil9104 6 ปีที่แล้ว +5

    Hi, it worked when i used locations as /, /codify, /linker but when i tried to put the location as /codify/linker it's not working.. how write the location and rewrite line of code in that case

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

    Thank you... its a 2016 one, but still helpful. Thanks a lot

  • @rajeshkumar-jl6in
    @rajeshkumar-jl6in 10 หลายเดือนก่อน

    how about state management ? my second project will have seperate provider and my first will have seperate provider..incase if i dont need presist what will be the approach which store provider will the project accept

  • @GSKHappyLearning
    @GSKHappyLearning 5 หลายเดือนก่อน

    does it work for the perticular ip entered instead of localhost, i want the multiple react projects to work from same ip and port with the different basename

  • @galihprasetiyo191
    @galihprasetiyo191 7 ปีที่แล้ว +2

    sir. what the version of nginx you use? i tried with nginx 1.10 not work

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

    I want to do something similar to this.
    My situation:
    Nginx webserver hosted at home on my server, running multiple servers blocks on the SAME port. site1.example.com, site2.example.com and site3.example.com.
    I installed Nginx on a VPS to use it as a reverse proxy for my 3 sites on the SAME port. How can i do this? I already tried your config, but it won't work if all 3 files in "sites-enabled" have the same port.
    Thanks!

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

    hi
    nginx server is running successfully
    but when add location /codify and rewrite code then i got internal server error
    any body help

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

    this is cool, but my all static file (/stylesheets/style.css etc.) in the second app to be broke, can you tell me how to fix it? thanks

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

    how about the subsequent requests though? this is only root routing.

  • @mastroes
    @mastroes 6 ปีที่แล้ว

    Nginx is running in my environment as a load balancer 2 web servers. If both web servers fail to serve a request or are down for some reason. Can nginx return a static page. Is this possible ?

  • @Nikhilkumar-fz1ci
    @Nikhilkumar-fz1ci 2 ปีที่แล้ว

    I have tried the same thing but iam getting 500 internal server error when i use rewrite url with reverse proxy. can you please help on it???

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

    Hey can i host my angular App and The django rest Backend on the same Server using This technique...

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

    How can I serve few pages of my application through Angular when entire App is built on top of Angular JS?

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

    doesnt work with a react container. Could u help out?

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

    how can i not break /codify and just change the port?

  • @b.ravirao1655
    @b.ravirao1655 5 ปีที่แล้ว

    Hi Mahtab, is there any way to do this in apache ? If yes, then can you please make a video on that

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

    Very nice tutorial. Thanks for sharing

  • @jackchou1425
    @jackchou1425 7 ปีที่แล้ว +2

    clear and useful, thank you for sharing~

  • @gpchanaka
    @gpchanaka 7 ปีที่แล้ว

    Very good tutorial... Thank you very much...

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

    thank you so much, this helped a lot......

  • @sameerahmed4439
    @sameerahmed4439 6 ปีที่แล้ว

    Us Salamo Alaekum bhai, i have to do a task
    i have three dashbo ards
    user
    vendor
    admin
    i have installed nginx on server and have kept their respective files in var/www/html
    i want when i do
    ip => then it should land on USER
    ip/vendor => should land on vendor
    ip/admin => should land on admin
    they are not running on any port rather they are just dist files

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

    Thank you so much! This is very useful

  • @AnuragBisht
    @AnuragBisht 7 ปีที่แล้ว

    Thanks for the tutorial, I have a query. We can route a request depending upon the url path in the app itself. So, what benefit it holds doing it in nginx ? like
    in app:
    app.get('/codify', function () {# codify code} )
    app.get('/linker', function () {# linkercode} )

    • @brianolsen87
      @brianolsen87 7 ปีที่แล้ว +2

      So the video is illustrating all services (or apps) being run on the same server (localhost) but the real power of a reverse proxy is that if I have two domains, is when you have multiple domains: www.myFirstApp.com and www.mySecondApp.com and you want them to point to the same ip address (1.2.3.4) on port 80 so that people don't have to specify an ip + port.
      So on my server I will host first app at ip 1.2.3.4 and port 1234 and my second app at 1.2.3.4 and port 1235.
      when I get a request from myFirstApp.com, nginx will forward the request to 1.2.3.4:1234 and return the response given by that application to the client. Likewise with mySecondApp.com, it will forward the request to 1.2.3.4:1235 and respond to the client.
      But nginx doesn't stop there. It can also work as a load balancer (it will rotate over multiple servers hosting the same application to distribute the web requests for really busy sites). It can also be an easy way to serve static html files and much more.

  • @vimanyuaggarwal1420
    @vimanyuaggarwal1420 7 ปีที่แล้ว

    I want to do the exact same configuration but on Centos. Any help?

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

    Great video, thanks

  • @raymondwei7709
    @raymondwei7709 7 ปีที่แล้ว

    Can I get rid of the ending slash, as in localhost/codify/ to be localhost/codify

    • @alammahtab08
      @alammahtab08  7 ปีที่แล้ว

      Just try it, I think you can.

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

    the best tutorial

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

    Thank you

  • @anhhoangviettran6550
    @anhhoangviettran6550 10 หลายเดือนก่อน

    this knowledge i want

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

    Thanks

  • @jolly1039
    @jolly1039 7 ปีที่แล้ว

    I cannot get my reverse proxy to work using the above youtube video
    I have multiple web hosted on different VM server on a same machine. Example
    Main Server, IP ADDRESS: 192.168.1.3, Window 10 running Oracle VirtualBox
    VM1, UBUNTU, IP ADDRESS: 192.168.1.12, Wordpress
    VM2, UBUNTU, IP ADDRESS: 192.168.1.13, PLEX
    VM3, UBUNTU, IP ADDRESS: 192.168.1.14, Owncloud
    I have a free domain name called lioville.ddns.net and this is DDNS onto my WAN IP address. I have only 1 WAN IP address from my ISP
    My question is how do I create a sub-directory to point to WAN IP address which in turn point to different IP address? For example
    lioville.ddns.net/VM1 -> WAN IP ->92.168.1.12
    lioville.ddns.net/VM2 -> WAN IP ->192.168.1.13
    lioville.ddns.net/VM3 -> WAN IP ->192.168.1.14

    • @alammahtab08
      @alammahtab08  7 ปีที่แล้ว

      Hi James, can you post your configuration file.

    • @jolly1039
      @jolly1039 7 ปีที่แล้ว

      I have a 2 virtual machine
      Virtual Machine 1 - NGINX - 192.168.1.5
      Virtual Machine 2 - Webserver - 192.168.1.7
      I can access Webserver when I am logged into NGINX Virtual Machine.
      My configuration file is (in NGINX virtual machine) :
      file name:node-app, saved in sites-available and linked to sites-enabled
      server {
      listen 80;
      location / {
      proxy_pass "192.168.1.7";
      }
      }
      However when I am in NGINX virtual machine and type in localhost all I get is the NGINX website.
      By the way my webserver is using SSL not sure whether that will affect it or not

    • @jolly1039
      @jolly1039 7 ปีที่แล้ว

      Hi its me again :) yes I got it to work thanks for your help, but are there a way that I can reverse proxy a subfolder say lioville.ddns.net/media will be pointed to another ip address
      example
      server{
      listen 80:
      server_name lioville.ddns.net/media;
      location / {
      proxy_pass "192.168.1.11:32400";
      }
      }
      Thanks Mahtab

    • @alammahtab08
      @alammahtab08  7 ปีที่แล้ว

      I haven't tried it but it should work. Does that IP points to another machine on the network? Give it a try.

  • @James-li8cm
    @James-li8cm 6 ปีที่แล้ว

    port not poat

  • @yohanessahrul9686
    @yohanessahrul9686 6 ปีที่แล้ว

    thank's sir

  • @mraghu5014
    @mraghu5014 7 ปีที่แล้ว

    Hi Mahtab..Thanks for sharing ...may you please upload the documentlink or share

  • @alexpurkhalo711
    @alexpurkhalo711 7 ปีที่แล้ว

    awesome!

  • @deepayansahu6120
    @deepayansahu6120 6 ปีที่แล้ว

    thanks

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

    5 minutes trying to say a simple thing in English and still can't do it

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

    learn how to actually host multiple apps then come back make a video. cheap cheating by changing url and manually running 3 times 3 apps