### download the raw source code .tar.gz location /phpmyadmin { #Default Ubuntu nginx root root /usr/share/nginx/www; index index.php; } location ~ ^/phpmyadmin.+.php$ { #Default Ubuntu nginx root root /usr/share/nginx/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
Configure nginx.conf to add the subdomains:
#sudo apt-get install phpmyadmin server { listen 80; server_name phpmyadmin.domain1.com phpmyadmin.domain2.com; location / { root /usr/share/phpmyadmin; index index.php; } location ~ .php$ { fastcgi_pass 127.0.0.1:49232; #this must point to the socket spawn_fcgi is running on. fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$fastcgi_script_name; # same path as above include /etc/nginx/fastcgi_params; } }
Restart nginx to test the subdomain.
sudo /etc/init.d/nginx restart
REFERENCES
http://www.base-10.net/blog/2009/11/06/nginx-and-non-document-root-phpmyadmin/
http://blog.rubynginx.com/index.php/2010_01_25/setup-awstats-phpmyadmin-phppgadmin-with-nginx-on-ubuntu/