Quantcast
Channel: Notes on Science
Viewing all articles
Browse latest Browse all 14

phpMyAdmin for nginx

$
0
0

nginx環境でphpMyAdminを使う方法。

OSはUbuntu12.04で行っています。
phpMyAdminをインストールすると設定画面が立ち上がるのだが、ここで選択できるサーバはApacheとlighttpdだけでnginxがない。

この設定画面はCtrl+Cか何かで終了して、nginxの設定ファイルを手動で作る。
下記の設定のようにドメイン名(domain.comなど)の設定ファイルを作ると、http://domain.com/phpmyadmin からログイン出来るようになる。

# ln -s /usr/share/phpmyadmin /usr/share/nginx/www
# vi /etc/nginx/sites-available/domain.com

location /phpmyadmin {
  root /usr/share/;
  index index.php index.html index.htm;

  location ~ ^/phpmyadmin/(.+\.php)$ {
    try_files $uri =404;
    root /usr/share/;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }

  location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
    root /usr/share/;
  }
} 

location /phpMyAdmin {
  rewrite ^/* /phpmyadmin last;
}


Viewing all articles
Browse latest Browse all 14

Trending Articles