How to change Root URL

Hi,

I am new to nginx.

How can I change my URL from lets say
http://ip:80/sample/chap1/demo.jspto
http://ip:80/*test/*sample/chap1/demo.jsp { pl note the path test
between
IP:port and sample)

rgds,

On Tue, Mar 29, 2011 at 12:48:56AM +0530, Mohammed Ashraf wrote:

Hi there,

I am new to nginx.

Welcome. There’s lots of good information at http://nginx.org/ and
http://wiki.nginx.org/ – you can check there to understand what the
suggested configuration will do.

How can I change my URL from lets say http://ip:80/sample/chap1/demo.jspto
http://ip:80/*test/*sample/chap1/demo.jsp { pl note the path test between
IP:port and sample)

I’d use a rewrite in the nginx config file, so when someone requests
/url, they are invited to instead request /new/url; and when they
request /new/url, they are given the content from the new directory.

Combining this example with the question in the Subject: line, I
suggest:

location / {
rewrite ^ /test$request_uri? permanent;
}

location /test/ {
}

See, for example, Module ngx_http_rewrite_module
for what the rewrite directive does; and
http://wiki.nginx.org/HttpCoreModule#location for how the location
blocks
are matched.

Depending on what else you want the server to do, you will want more
location blocks; and you may want to add “^~” to one of the above
locations.

Good luck with it,

f

Francis D. [email protected]