Nginx config to serve multiple Wordpress from subdirectories

Hey guys, I want to install WP like this – and so on..

Here is my current configuration, could you please help me with the correct config?

server {  

    access_log   /var/log/nginx/;  
    error_log    /var/log/nginx/;  

    root /var/www/;  
    index index.php;  

    set $dir "";  

    if ($request_uri ~ ^/([^/]*)/.*$ ) {  
          set $dir1 /$1;  

    location / {  
            try_files $uri $uri/ $dir1/index.php?$args;  

    location ~ \.php$ {  
           include fastcgi_params;  
            fastcgi_pass unix:/var/run/php5-fpm.sock;  


This config is giving me file not found errors on page/post links on both and etc.

Thanks for any help.

Try following changes…

 if ($request_uri ~ ^/member/([^/]*)/.*$ ) {  
          set $dir1 /$1;  

    location /member/ {  
            try_files /member$uri /member$uri/ /member/$dir1/index.php?$args;