apachenginxmod-vhost-alias

Is there an NGINX equivalent of Apache's Directory Interpolation


With Apache's mod_vhost_alias you can use Directory Interpolation to serve sites based on directory structure. See here http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html#interpol

Is this possible with NGINX? if so how?


Solution

  • The simplest one would be:

    server {
        listen 80 default_server;
        root /var/www/$host;
    }
    

    For http://www.example.com/directory/file.html this will serve file /var/www/www.example.com/directory/file.html.