How can I get nginx to display webapp in **/here ?

Posted July 29, 2016 2.9k views
NginxServer OptimizationUbuntu 16.04

I’ve built a web app and now I would like to move it to it’s own / location on my domain, I thought doing the following would work;

location /here {

but that doesn’t work, if I proxy_pass the app to the / location it works fine.

Any help would be greatly appreciated.

1 comment
  • if I proxy_pass the app to the / location it works fine.
    What do you mean? If it works fine, why not do that?
    And just saying “it doesn’t work” doesn’t say anything. You need logs, configurations, environment information etc. to give some help..

    Try something like this:

            location \here {
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers


If you rewrite the URL before proxying the request to the backend, it will receive the correct URL while still being served under /here:

location /here {
    rewrite ^/here/(.*)$ /$1 break;
    proxy_redirect    off;

What I mean is if a proxy_pass the app at the / location I can view the app fine at my domains address but I dont want that, what I am looking for is have the app be accessible from