Create a conf file under location /etc/nginx/conf.d with any name and extension .conf :
server {
listen 80;
server_name <server>;
location /ctx01 {
proxy_pass http://host:port/ctx01/;
}
location /ctx02 {
proxy_pass http://host:port/ctx02/;
}
location / {
root /usr/share/nginx/html;
index index.html;
}
}
This will redirect the request with /ctx01 to http://host:port/ctx01.
Request with /ctx02 to http://host:port/ctx02.
For e.g. http://<server>:80/ctx01 will redirect to http://host:port/ctx01
If you want to have a home page, configure index.html under /usr/share/nginx/html.
server {
listen 80;
server_name <server>;
location /ctx01 {
proxy_pass http://host:port/ctx01/;
}
location /ctx02 {
proxy_pass http://host:port/ctx02/;
}
location / {
root /usr/share/nginx/html;
index index.html;
}
}
This will redirect the request with /ctx01 to http://host:port/ctx01.
Request with /ctx02 to http://host:port/ctx02.
For e.g. http://<server>:80/ctx01 will redirect to http://host:port/ctx01
If you want to have a home page, configure index.html under /usr/share/nginx/html.
No comments:
Post a Comment
Thank You for your valuable comment