Reputation: 993
I am running nginx
which is listening on port number 9000.
The redirect rules are as follows:
/
should go to index.html
./rest
should forward the request to background service.rule 1
and rule 2
should forward to rule 1
or index.htmlMy sample nginx
configuration file is as follows:
server {
listen 9000;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 404 403 405 500 502 503 504 = @notfound;
location /rest {
proxy_pass http://localhost:12000;
}
location @notfound {
return 301 http://localhost/;
}
}
My redirect is not working properly, and it will redirect to http://localhost
instead of http://localhost:9000
.
Can anybody point out where am I doing the mistake.
Upvotes: 2
Views: 923
Reputation: 146630
return 301 http://localhost/;
should be return 301 http://localhost:9000/;
Upvotes: 1