0

I have .conf file like this

    events {
        worker_connections  1024;
    }

    http {

    server {
        listen       80;
        location / {

            proxy_pass  http://example.com;

        }
      location /app {
    proxy_pass http://www.example.org/application;
}
    }

    }

When i ran the above the above conf file for localhost/80 it is showing correctly. but when i used localhost/80/app it is showing 404 page not found.

Do i have to keep only one location field in one server?

May i know what wrong i am doing?

Thanks

Private
  • 277
  • 1
  • 2
  • 9
  • Directly accessing the `http://google.in/app/` URL also results in a 404 error, so why should a proxied request to `http://127.0.0.1:81/app/` show anything else? -|- In other words: In your questions please refrain from using random domain names and use either your *own domain* or one of the [RFC 6761](https://tools.ietf.org/html/rfc6761#section-6.5) reserved domain names such as `example.com`, `example.org` or similar . Please refer to [this Q&A](http://meta.serverfault.com/q/963/37681) for our recommendations with regards to how and what (not) to obfuscate in your questions. – HBruijn Apr 03 '17 at 15:10
  • Thanks..So,you are saying if `http://example.org/app` is a valid URL then definitely i will get the response right.. – Private Apr 03 '17 at 16:01
  • No, he is not saying that. He was telling that you should use those reserved domain names in questions here for clarity. – Tero Kilkanen Apr 03 '17 at 16:07

1 Answers1

0

You should try:

location /app {
    proxy_pass http://www.example.org/application;
}
Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63