title: Nginx change /phpmyadmin directory
body: <p>I am trying to get example.com/phpmyadmin to route to a different directory from my site so I can use one universal phpmyadmin install for all of my sites. I have tried this:</p>
  
  <pre><code>server {
      listen      80;
      server_name example.com;
  
      location / {
          root    /home/web/example.com/public_html;
          index   index.html index.htm index.php;
      }
  
      location ~ \.php$ {
          root /home/web/example.com/public_html;
          if ($request_uri ~* /phpmyadmin) {
              root /home/web/phpmyadmin;
          }
          try_files $uri =404;
          fastcgi_pass   unix:/tmp/php5-fpm.sock;
          fastcgi_index  index.php;
          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          include        fastcgi_params;
      }
  }
  </code></pre>
  
  <p>This doesn't seem to work at all.</p>
  
  <p>And I have also tried this:</p>
  
  <pre><code>server {
      listen      80;
      server_name example.com;
  
      location / {
          root    /home/web/example.com/public_html;
          index   index.html index.htm index.php;
      }
  
      location /phpmyadmin {
          root    /home/web/phpmyadmin;
          index   index.html index.htm index.php;
      }
  
      location ~ \.php$ {
          root /home/web/example.com/public_html;
          try_files $uri =404;
          fastcgi_pass   unix:/tmp/php5-fpm.sock;
          fastcgi_index  index.php;
          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          include        fastcgi_params;
      }
  }
  </code></pre>
  
  <p>After when I check my error logs with this file I get:</p>
  
  <pre><code>2013/06/28 01:10:47 [error] 7068#0: *1 "/home/web/phpmyadmin/phpmyadmin/index.html" is not found (2: No such file or directory)
  </code></pre>
  
  <p>So in the location block I changed root to /home/web, thinking it will take out the extra phpmyadmin, however, instead, I don't get anything about phpmyadmin at all in my error log. I can't seem to figure out the correct configuration and why this one is not working. Any ideas?</p>