0

So basically I had to proxypass the root of a web server @

/

but the application is hosted at

/ui

When they don't manually type /ui they are presented with the home page of the server, which is static and not being used. I want to initially have Nginx move you to domain.com/ui when you type domain.com then basically just do what it normally does and proxy the application.

FreeSoftwareServers
  • 515
  • 1
  • 8
  • 26

2 Answers2

1

I put this inside my https server block and it redirects the given url, in this example https://subdomain.domain.com to https://subdomain.domain.com/ui and send a permanent flag to remote browser for future reference/speed. I assume that is why atleast

rewrite ^/$ /ui permanent;

or

rewrite ^/$ /path permanent;

Full Configs:

server {
   listen         80;
   server_name    subdomain.domain.com;

   return         301 https://$server_name/;
 }

server {
listen 443 ssl;
server_name subdomain.domain.com;

rewrite     ^/$ /ui permanent;

location / {

    proxy_pass stuff
    }
}
FreeSoftwareServers
  • 515
  • 1
  • 8
  • 26
0

Try something like this - I can't guarantee it will work, but it's worth a shot. Basically it's saying "send requests for the UI folder to this other server". You may need the rewrite in the other answer as well or instead.

location /ui {
  proxy_pass (etc);
}
Tim
  • 31,888
  • 7
  • 52
  • 78
  • I tried that first trust me, I can't proxypass /ui and the default webroot gets repopulated @reboot so even when I moved /ui to doc root it worked but not persistently, and same with symlinks. I got it tho, thank you! – FreeSoftwareServers Feb 04 '16 at 04:38
  • @FreeSoftwareServers Is the link you've provided correct? Could you check please? – gxx Feb 04 '16 at 06:46
  • I got a [whole question](http://serverfault.com/questions/752323/nginx-proxypass-only-works-via-subdomain-not-domain-com-path?noredirect=1#comment946739_752323) on why I can't proxypass /path, only works via subdomain.domain.com and I also can't proxypass /ui, but thats not a NginX issue. – FreeSoftwareServers Feb 04 '16 at 21:27