How to use nginx proxy_pass

How can I specify a url path in proxy_pass. Below is the nginx conf file

location / {
    proxy_pass http://www.example.com/
}

The url http://www.example.com/ will redirect dynamically to http://www.example.com/image/file.aspx?img=1

How to specify a url which internally redirect to another url. Any help on this will be really helpful

Try the nginx HttpRewriteModule you dont need a proxy for these(tho). it follows this format:

rewrite regex         replacement                              flag
   |      |                |                                    |
rewrite   ^/    http://www.example.com/image/file.aspx?img=1 permanent;

Then:

location / {

    rewrite ^/ http://www.example.com/image/file.aspx?img=1 permanent;

}