title: How to create nginx alias to wordpress plugins directory
body: <p>I am running wordpress on nginx and trying to create an alias that will point to a plugin directory where I have written some of my own plugins that I have versioned under git. Currently I am using unix symlinks to do the job however I would prefer to do this (if possible) with nginx and make my transition from dev to prod more seamless. I cannot seem to get the configuration correct. I have included my directory structure and nginx config below. Any help would be appreciated - Thanks!</p>
  
  <p><strong>WP Install (<em>Shows symlinks which I would like to replace with nginx alias</em>)</strong></p>
  
  <pre><code>/home/foobar/www/wordpress
  ---- /wp-content/plugins
  -------- /hello-dolly/
  -------- /akismet/
  -------- mycustom1 -&gt; /home/foobar/myplugins/mycustom1/
  -------- mycustom2 -&gt; /home/foobar/myplugins/mycustom1/
  </code></pre>
  
  <p><strong>My custom plugins (<em>versioned under git</em>)</strong> </p>
  
  <pre><code>/home/foobar/myplugins
  ---- /mycustom1/
  ---- /mycustom2/
  </code></pre>
  
  <p><strong>Nginx Configuration</strong></p>
  
  <pre><code>server {
  
      listen       80;
  
      server_name foobar.com;
      root    /home/foobar/www/wordpress;
      index   index.php;
  
      autoindex    off;   
  
      location / {
          try_files $uri $uri/ /index.php?$args;        
      }
  
      location /wp-content/plugins/myplugin {
          alias /home/foobar/myplugins/mycustom1/;
      }
  
      # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
      location ~ \.php$ {
          fastcgi_pass   127.0.0.1:9000;
          fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_buffer_size 4K;
          fastcgi_buffers 64 4k;
          fastcgi_connect_timeout 300;
          fastcgi_send_timeout 300;
          fastcgi_read_timeout 300;
          include  /etc/nginx/fastcgi_params;
          fastcgi_param WP_ROOT $document_root;
      }
  
  }
  </code></pre>