Support #678
Install Phppgadmin on FreeBSD
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; }
- And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
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
- And change the following two parameters:
- 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
- Make the following changes:
- 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; } }
- And add the following:
- Restart nginx:
service nginx restart
- Now open a web browser and go to http://pg.example.com:8080 to use phpPgAdmin.
vi /usr/local/www/phpPgAdmin/conf/config.inc.php
- And change the extra_login_security parameter to false:
$conf['extra_login_security'] = false;