Project

General

Profile

Support #678

Install Phppgadmin on FreeBSD

Added by Daniel Curtis almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database Server
Target version:
Start date:
10/18/2015
Due date:
% Done:

100%

Estimated time:
0.50 h
Spent time:

Description

This is a guide on installing phppgadmin with nginx on FreeBSD 10.

Prepare the Environment

  • Make sure the system is up to date:
    pkg update && pkg upgrade
    
  • Install portmaster and update the ports tree:
    pkg install portmaster
    portsnap fetch extract
    pkg2ng
    
  • Set the default postgresql version to 9.4:
    echo "DEFAULT_VERSIONS= postgresql=9.4" >> /etc/make.conf
    

Install Nginx

  • Install nginx and php56
    pkg install nginx php56
    
  • Start and enable nginx at boot:
    echo 'nginx_enable="YES"' >> /etc/rc.conf
    service nginx start
    
  • Create a configuration directory to make managing individual server blocks easier
    mkdir /usr/local/etc/nginx/conf.d
    
  • Edit the main nginx config file:
    vi /usr/local/etc/nginx/nginx.conf
    
    • And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
      #user  nobody;
      worker_processes  1;
      error_log  /var/log/nginx-error.log;
      
      events {
          worker_connections  1024;
      }
      
      http {
          include       mime.types;
          default_type  application/octet-stream;
      
          sendfile        on;
          #tcp_nopush     on;
      
          #keepalive_timeout  0;
          keepalive_timeout  65;
      
          #gzip  on;
      
          # Load config files from the /etc/nginx/conf.d directory
          include /usr/local/etc/nginx/conf.d/*.conf;
      }
      

Configure PHP-FPM

  • Configure the default PHP settings
    cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
    
  • Edit the php config file:
    vi /usr/local/etc/php.ini
    
    • And change the following two parameters:
      upload_max_filesize = 100M
      post_max_size = 100M
      max_input_time = 600
      
  • Edit /usr/local/etc/php-fpm.conf:
    vi /usr/local/etc/php-fpm.conf
    
    • Make the following changes:
      listen = /var/run/php-fpm.sock
      listen.owner = www
      listen.group = www
      listen.mode = 0660
      
  • Start and enable PHP-FPM at boot:
    echo 'php_fpm_enable="YES"' >> /etc/rc.conf
    service php-fpm start
    

Install Phppgadmin

  • Install phppgadmin:
    pkg install phppgadmin
    
  • Now create a file to enable phppgadmin:
    vi /usr/local/etc/nginx/conf.d/phppgadmin.conf
    
    • And add the following:
      server {
          listen          8080;
          server_name     pg.example.com;
      
          client_max_body_size 100m;
          client_body_timeout 600;
      
          location / {
              root    /usr/local/www/phpPgAdmin;
              index   index.html index.htm index.php;
          }
      
          location ~ \.php$ {
              root            /usr/local/www/phpPgAdmin;
              fastcgi_pass unix:/var/run/php-fpm.sock;
              fastcgi_index   index.php;
              fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
              include         fastcgi_params;
          }
      }
      
  • Restart nginx:
    service nginx restart
    
NOTE: I needed to edit the phpPgAdmin config file
vi /usr/local/www/phpPgAdmin/conf/config.inc.php
  • And change the extra_login_security parameter to false:
    $conf['extra_login_security'] = false;
    

History

#1 Updated by Daniel Curtis almost 5 years ago

  • Description updated (diff)
  • Status changed from New to In Progress
  • % Done changed from 0 to 50

#2 Updated by Daniel Curtis almost 5 years ago

  • Description updated (diff)
  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 100

#3 Updated by Daniel Curtis almost 5 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF