我想知道,并已经做了一些广泛的search,如何服务一个基于domain.LTD扩展名的静态文件。
Nginx.conf:
error_page 502 /maintenance.html; location = /maintenance.html { root /srv/books/current/app/views/layouts/; }
我想要的是基于当前请求的域的扩展来提供本地化的维护页面。 这可能以某种方式使用正则expression式或任何nginx指令?
怎么样像..
error_page 502 /maintenance.html; location = /maintenance.html { if ($http_host ~* "\.([^\.]+)$") { set $tld $1; rewrite ^ /maint/$tld.html last; } } location /maint/ { root /path/to/somewhere/maint/com.html; }
这应该会使它为example.com的maint页面加载com.html等。