nginx how can I rewrite a location -


i want http://localhost/health -> http://localhost/health.html , how can write location config?

this location ,but not work.

location ^~  /health {     root   /usr/share/nginx/html;     index  health.html ; }  location / {     root   /usr/share/nginx/html;     index  index.html index.htm; } 

thanks help.

use rewrite directive.

location / {     root   /usr/share/nginx/html;     index  index.html index.htm;      rewrite ^/heath/?$ /health.html? break; } 

source: http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -