Support #397

Install phpMyAdmin with nginx on FreeBSD

Added by Daniel Curtis about 10 years ago. Updated over 8 years ago.

Database Server
Target version:
Start date:
Due date:
% Done:


Estimated time:
0.50 h
Spent time:


Now you can handle the administration of MySQL over the Web and on FreeBSD. It can manage a whole MySQL server as well as a single database. With phpMyAdmin you can easily browse through databases and tables, create, copy, rename, alter and drop databases and tables and many more.

Root access is required to edit the following files and to execute commands. Log in as root (su) or simply prepend sudo to all commands that require root privileges.

Make sure everything is up to date:

pkg update && pkg upgrade && portsnap fetch extract

Install nginx

  • Install nginx:
    pkg install nginx

Install phpMyAdmin

Install phpMyAdmin from your ports directory. I chose the default configuration without X11 and OpenSSL:

cd /usr/ports/databases/phpmyadmin
make install clean

Configure phpMyAdmin for Nginx

This is an example server block for your Nginx configuartion file:
vi /usr/local/etc/nginx.conf
  • And add the following server block:
    server {
            listen 81;
            server_name localhost;
            location / {
                root /usr/local/www/phpMyAdmin;
                index index.php index.html index.htm;
            location ~ \.php$ {
                root /usr/local/www/phpMyAdmin;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
            location ~ /\.ht {
                deny all;

Enable and start the services

  • Enable php-fpm and nginx:
    echo 'nginx_enable="YES"' >> /etc/rc.conf
    echo 'php_fpm_enable="YES"' >> /etc/rc.conf
  • Start php-fpm and nginx:
    service nginx start
    service php-fpm start

Updated by Daniel Curtis about 10 years ago

  • Description updated (diff)
  • Status changed from In Progress to Closed

Updated by Daniel Curtis over 9 years ago

  • Project changed from 82 to FreeBSD Administration
  • Description updated (diff)
  • % Done changed from 50 to 100

Updated by Daniel Curtis over 9 years ago

  • Target version set to FreeBSD 9

Updated by Daniel Curtis over 9 years ago

  • Subject changed from How to Install nginx with phpMyAdmin on FreeBSD to Install phpMyAdmin with nginx on FreeBSD
  • Description updated (diff)
  • Category set to Database Server

Updated by Daniel Curtis over 8 years ago

  • Description updated (diff)

Also available in: Atom PDF