Tuesday, January 1, 2013

User-based website directory with Nginx

User-dir mode can be done by using regex captures. Here is an example to configure your nginx:

        location ~ ^/~(.+?)(/.*)?$ {
                alias /home/$1/public_html$2;
                index  index.html index.htm;
                autoindex on;
        }


2 comments:

  1. How can I wire in php-fpm going to a sock file that matches the user?
    e.g. fastcgi_pass unix:/var/run/php-fpm/$1.sock;

    ReplyDelete
  2. you may find a solution in the following link:

    http://forum.nginx.org/read.php?25,246788

    ReplyDelete