1
votes

I am trying to use nginx as a reverse proxy for my Odoo deployment. Indeed I have two instances accessible respectively on port 8069 and 8090. Is it possible to configure nginx for these two instances given that I have only IP address (I don't want to use a domain name)?

I have tried something like this:

server{
   listen 80 default_server;
   server_name my_ip_address/instance1;

   location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://localhost:8090;
   }

}

server{
   listen 80;
   server_name my_ip_address/instance2;

   location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://localhost:8099;
   }

}

And I have tried also

server{
   listen 80 default_server;
   server_name my_ip_address;

   location /instance1 {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://localhost:8090;
   }

}

server{
   listen 80;
   server_name my_ip_address;

   location /instance2 {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://localhost:8099;
   }

}

But when I try to access my_ip_address/instance1 or my_ip_address/instance2 neither is working

1

1 Answers

0
votes

I don't think this is something possible as you have to rewrite the paths to assets and form actions as well.

assets include all the javascript and CSS files as well as the images.

form actions are where the data of a form should be redirected.

so for example when you login to the system, the login form sends the data to /web/login action.

how are you going to handle this? and in which virtual host of your virtual hosts?!

On the other hand, try to use subdomains. or if you have to use IPs, then use 2 IPs referring to the same server and redirect each IP used in as host to one of your instances.