NGINX
support rewriting of the request internally.
Example
rewrite /details /aboutme;
rewrite /info /aboutme;
location = /aboutme {
return 200 "Application Name: $app, \nversion: $version";
}
nginx.info
events {
}
http {
server {
listen 9090;
server_name localhost;
set $app 'Chat Server';
set $version 1.23;
rewrite /details /aboutme;
rewrite /info /aboutme;
location = /aboutme {
return 200 "Application Name: $app, \nversion: $version";
}
}
}
Validate
and reload the configurations.
$sudo nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
$
$sudo nginx -s reload
Open the
url ‘http://localhost:9090/info’ in browser, you can see below screen.
Open the
url 'http://localhost:9090/info', you can see below screen.
Open the
url ‘http://localhost:9090/details’, you can see below screen.
No comments:
Post a Comment