nginx reverse proxy on different domain for different location with servername pathHelp needed setting up...

Make me a metasequence

Second-rate spelling

How would we write a misogynistic character without offending people?

Where was Karl Mordo in Infinity War?

Whom do I have to contact for a ticket refund in case of denied boarding (in the EU)?

Is there a German word for “analytics”?

Canadian citizen, on US no-fly list. What can I do in order to be allowed on flights which go through US airspace?

How to kill a localhost:8080

What happened to QGIS 2.x

How to speed up a process

Linear regression when Y is bounded and discrete

Is there a ternary operator in math

Is the helper verb 'werden' mandatory in both passive clauses separated by an 'oder', or only at the very the end?

What's the difference between a cart and a wagon?

Use comma instead of & in table

Is it possible to convert a suspension fork to rigid by drilling it?

What are all the squawk codes?

Reason why dimensional travelling would be restricted

Why is s'abonner reflexive?

Non-Italian European mafias in USA?

What am I? I am in theaters and computer programs

A "strange" unit radio astronomy

Is my plan for fixing my water heater leak bad?

How to approximate rolls for potions of healing using only d6's?



nginx reverse proxy on different domain for different location with servername path


Help needed setting up nginx to serve static filesnginx redirect issue with upstream configurationsvn using nginx Commit failed: path not foundNginx proxy pass works for https but not httpnginx load balancer rewrite to listen portNginx subversion commit failureNginx/Apache: set HSTS only if X-Forwarded-Proto is httpsnginx reverse proxy hide login query also on 301 redirect or full qualified urlUniversal HTTPS to HTTP reverse proxy using nginxConfigure NGINX : How to handle 500 Error on upstream itself, While Nginx handle other 5xx errors













0















I have two python django web applications A1 & B1. A1 runs on 8000 port and B1 runs on 8001 port on same server. A1 and B1 both are https and both are configured in same nginx and both works successfully.



Everything was working fine until a new requirement came.
We need to open https://A1/location1 as https://B1 but it should show https://A1/location1 in address bar.



Here what I have tried till now in my nginx's sites-available config.



server {
listen 443;
server_name A1;
ssl on;
ssl_certificate /certificate/file/path;
ssl_certificate_key /private/key/filepath;
location /location1/ {
proxy_pass https://loan.fundspi.com/;
}
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}
location /media {
alias /opt/A1/media;
}
location /static {
alias /opt/A1/static;
}

server {
listen 443;
server_name B1;
ssl on;
ssl_certificate /certificate/file/path;
ssl_certificate_key /private/key/filepath;
location / {
proxy_pass http://127.0.0.1:8001/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
}
location /media {
alias /opt/B1/media;
}
location /static {
alias /opt/B1/static;
}

}


It opens https://B1 as https://A1/location1 what is expected but css js images do not load here. It tries to get css /js /images from path https://A1/static/js/file.js, https://A1/static/css/file.css or https://A1/static/img/file.png. Other site's js css img is not in static folder of project A1. They are present in static folder B1. That's why most of them 404.



I can not put static folder of B1 into static folder of A1. They are totally different. Some filenames are same but content is different. It will mess up the https site A1



There will be other locations too which will show content of B1's inner pages when user will open A1's inner pages but url will be of A1.



Please help me to write correct configuration file for this requirement.










share|improve this question



























    0















    I have two python django web applications A1 & B1. A1 runs on 8000 port and B1 runs on 8001 port on same server. A1 and B1 both are https and both are configured in same nginx and both works successfully.



    Everything was working fine until a new requirement came.
    We need to open https://A1/location1 as https://B1 but it should show https://A1/location1 in address bar.



    Here what I have tried till now in my nginx's sites-available config.



    server {
    listen 443;
    server_name A1;
    ssl on;
    ssl_certificate /certificate/file/path;
    ssl_certificate_key /private/key/filepath;
    location /location1/ {
    proxy_pass https://loan.fundspi.com/;
    }
    location / {
    proxy_pass http://127.0.0.1:8000/;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $http_host;
    }
    location /media {
    alias /opt/A1/media;
    }
    location /static {
    alias /opt/A1/static;
    }

    server {
    listen 443;
    server_name B1;
    ssl on;
    ssl_certificate /certificate/file/path;
    ssl_certificate_key /private/key/filepath;
    location / {
    proxy_pass http://127.0.0.1:8001/;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $http_host;
    }
    location /media {
    alias /opt/B1/media;
    }
    location /static {
    alias /opt/B1/static;
    }

    }


    It opens https://B1 as https://A1/location1 what is expected but css js images do not load here. It tries to get css /js /images from path https://A1/static/js/file.js, https://A1/static/css/file.css or https://A1/static/img/file.png. Other site's js css img is not in static folder of project A1. They are present in static folder B1. That's why most of them 404.



    I can not put static folder of B1 into static folder of A1. They are totally different. Some filenames are same but content is different. It will mess up the https site A1



    There will be other locations too which will show content of B1's inner pages when user will open A1's inner pages but url will be of A1.



    Please help me to write correct configuration file for this requirement.










    share|improve this question

























      0












      0








      0








      I have two python django web applications A1 & B1. A1 runs on 8000 port and B1 runs on 8001 port on same server. A1 and B1 both are https and both are configured in same nginx and both works successfully.



      Everything was working fine until a new requirement came.
      We need to open https://A1/location1 as https://B1 but it should show https://A1/location1 in address bar.



      Here what I have tried till now in my nginx's sites-available config.



      server {
      listen 443;
      server_name A1;
      ssl on;
      ssl_certificate /certificate/file/path;
      ssl_certificate_key /private/key/filepath;
      location /location1/ {
      proxy_pass https://loan.fundspi.com/;
      }
      location / {
      proxy_pass http://127.0.0.1:8000/;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $http_host;
      }
      location /media {
      alias /opt/A1/media;
      }
      location /static {
      alias /opt/A1/static;
      }

      server {
      listen 443;
      server_name B1;
      ssl on;
      ssl_certificate /certificate/file/path;
      ssl_certificate_key /private/key/filepath;
      location / {
      proxy_pass http://127.0.0.1:8001/;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $http_host;
      }
      location /media {
      alias /opt/B1/media;
      }
      location /static {
      alias /opt/B1/static;
      }

      }


      It opens https://B1 as https://A1/location1 what is expected but css js images do not load here. It tries to get css /js /images from path https://A1/static/js/file.js, https://A1/static/css/file.css or https://A1/static/img/file.png. Other site's js css img is not in static folder of project A1. They are present in static folder B1. That's why most of them 404.



      I can not put static folder of B1 into static folder of A1. They are totally different. Some filenames are same but content is different. It will mess up the https site A1



      There will be other locations too which will show content of B1's inner pages when user will open A1's inner pages but url will be of A1.



      Please help me to write correct configuration file for this requirement.










      share|improve this question














      I have two python django web applications A1 & B1. A1 runs on 8000 port and B1 runs on 8001 port on same server. A1 and B1 both are https and both are configured in same nginx and both works successfully.



      Everything was working fine until a new requirement came.
      We need to open https://A1/location1 as https://B1 but it should show https://A1/location1 in address bar.



      Here what I have tried till now in my nginx's sites-available config.



      server {
      listen 443;
      server_name A1;
      ssl on;
      ssl_certificate /certificate/file/path;
      ssl_certificate_key /private/key/filepath;
      location /location1/ {
      proxy_pass https://loan.fundspi.com/;
      }
      location / {
      proxy_pass http://127.0.0.1:8000/;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $http_host;
      }
      location /media {
      alias /opt/A1/media;
      }
      location /static {
      alias /opt/A1/static;
      }

      server {
      listen 443;
      server_name B1;
      ssl on;
      ssl_certificate /certificate/file/path;
      ssl_certificate_key /private/key/filepath;
      location / {
      proxy_pass http://127.0.0.1:8001/;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $http_host;
      }
      location /media {
      alias /opt/B1/media;
      }
      location /static {
      alias /opt/B1/static;
      }

      }


      It opens https://B1 as https://A1/location1 what is expected but css js images do not load here. It tries to get css /js /images from path https://A1/static/js/file.js, https://A1/static/css/file.css or https://A1/static/img/file.png. Other site's js css img is not in static folder of project A1. They are present in static folder B1. That's why most of them 404.



      I can not put static folder of B1 into static folder of A1. They are totally different. Some filenames are same but content is different. It will mess up the https site A1



      There will be other locations too which will show content of B1's inner pages when user will open A1's inner pages but url will be of A1.



      Please help me to write correct configuration file for this requirement.







      nginx reverse-proxy






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 13 mins ago









      DerekDerek

      12




      12






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f956852%2fnginx-reverse-proxy-on-different-domain-for-different-location-with-servername-p%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f956852%2fnginx-reverse-proxy-on-different-domain-for-different-location-with-servername-p%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Фонтен-ла-Гаярд Зміст Демографія | Економіка | Посилання |...

          Список ссавців Італії Природоохоронні статуси | Список |...

          Маріан Котлеба Зміст Життєпис | Політичні погляди |...