ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Reverse Proxy?

    IT Discussion
    5
    17
    3.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Alex Sage
      last edited by

      So, I have 1 fixed IP address, and 2 webservers, both running on port 80.

      I want subdomain #1 to resolve to server #1, and have subdoman #2 resolve to server #2.

      I have been researching this, and it seems I can do this, if I setup a reverse proxy on port 80.

      Anyone every do anything like this before?

      1 Reply Last reply Reply Quote 1
      • D
        dafyre
        last edited by

        I know it can be relatively easily done with Apache or Nginx. It has been a long time since I've done it with Apache, and I've never done it with Nginx.

        1 Reply Last reply Reply Quote 0
        • S
          scottalanmiller
          last edited by

          I do this with NGinX all the time, it is the primary use of NGinX. Apache will do it too, I just don't use it for that very often.

          But before we go down the rabbit hole let's be sure this is the right approach. Why is it that you have two web servers? Are these actually two different VMs? Or two web servers on one VM?

          1 Reply Last reply Reply Quote 0
          • A
            Alex Sage
            last edited by

            Yes, two different VM's.

            The problem is I need to run a web server, and screenconnect on the same domain, both using port 80.

            S 1 Reply Last reply Reply Quote 0
            • S
              scottalanmiller @Alex Sage
              last edited by

              @anonymous said:

              Yes, two different VM's.

              The problem is I need to run a web server, and screenconnect on the same domain, both using port 80.

              Okay, that makes sense then. I would just use NGinX for this, it is famously built for this usage and extreme efficient at it (and easy to set up.) You are reading this and responding to this via an NGinX Reverse Proxy doing exactly what you describe.

              1 Reply Last reply Reply Quote 0
              • A
                Alex Sage
                last edited by

                @scottalanmiller Thanks! I am looking for some kinda of step by step guide to get me started. Any ideas? I have googled, but I don't see much 😞

                1 Reply Last reply Reply Quote 0
                • S
                  scottalanmiller
                  last edited by

                  A bit busy at the moment but I can grab some code samples for you shortly.

                  Are you going to install NGinX to a new VM (vny-lnx-rprox) or to one of the same VMs as one of the other services?

                  1 Reply Last reply Reply Quote 0
                  • A
                    Alex Sage
                    last edited by

                    @scottalanmiller I would think it would make since to add it on my webserver? If not, I have made a new VM too. What would you do?

                    S 1 Reply Last reply Reply Quote 0
                    • W
                      WingCreative
                      last edited by

                      This might give you some helpful info to use as a jumping off point...

                      Good luck!

                      1 Reply Last reply Reply Quote 0
                      • S
                        scottalanmiller @Alex Sage
                        last edited by

                        @anonymous said:

                        @scottalanmiller I would think it would make since to add it on my webserver? If not, I have made a new VM too. What would you do?

                        What is the web server currently doing? Is it an Apache node?

                        1 Reply Last reply Reply Quote 0
                        • A
                          Alex Sage
                          last edited by

                          @scottalanmiller basic LAMP stack running WordPress for 5 domains using virtual hosts.

                          1 Reply Last reply Reply Quote 0
                          • S
                            scottalanmiller
                            last edited by

                            Okay. To put NGinX on there, you will need to move Apache to another port. Say 8080, for example. NGinX will get 80 and will then basically do NAT for you to 8080.

                            1 Reply Last reply Reply Quote 0
                            • W
                              WingCreative
                              last edited by

                              Here's a step-by-step guide for moving Apache to another port (8080, in fact) and setting up nginx as a reverse proxy for Apache on the same server.

                              1 Reply Last reply Reply Quote 1
                              • S
                                scottalanmiller
                                last edited by

                                Here is a sample of a site config from the /etc/nginx/sites-available folder on Ubuntu 15.04.

                                cat yoursitename.conf 
                                server {
                                	client_max_body_size 40M;
                                        listen 80;
                                
                                        server_name www.yoursitename.com;
                                
                                	location / {
                                        	proxy_set_header X-Real-IP $remote_addr;
                                        	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                        	proxy_set_header Host $http_host;
                                        	proxy_set_header X-NginX-Proxy true;
                                
                                        proxy_pass http://127.0.0.1:8080/;
                                        proxy_redirect off;
                                
                                	}
                                }
                                

                                127.0.0.1 is because this is the one running on the same machine. If you need to point to one on a different VM, just put the VM's IP address in that spot.

                                1 Reply Last reply Reply Quote 2
                                • A
                                  Alex Sage
                                  last edited by Alex Sage

                                  @scottalanmiller

                                  I see a bunch of fields here. The only ones I would need to edit is server_name and proxy_pass?

                                  Then just copy and paste to create more sites?

                                  S 1 Reply Last reply Reply Quote 0
                                  • S
                                    scottalanmiller @Alex Sage
                                    last edited by

                                    @anonymous said:

                                    @scottalanmiller

                                    I see a bunch of fields here. The only ones I would need to edit is server_name and proxy_pass?

                                    Then just copy and paste to create more sites?

                                    Correct.

                                    1 Reply Last reply Reply Quote 0
                                    • JaredBuschJ
                                      JaredBusch
                                      last edited by

                                      I hate searching this site...

                                      I swear there was a thread with a walk through on setting up nginx as a proxy for multiple servers....

                                      Anyone know where it is?

                                      1 Reply Last reply Reply Quote 0
                                      • 1 / 1
                                      • First post
                                        Last post