Support #678
Updated by Daniel Curtis about 10 years ago
This is a guide on installing phppgadmin with nginx on FreeBSD 10.
h2. Prepare the Environment
* Make sure the system is up to date:
<pre>
pkg update && pkg upgrade
</pre>
* Install portmaster and update the ports tree:
<pre>
pkg install portmaster
portsnap fetch extract
pkg2ng
</pre>
* Set the default postgresql version to 9.4:
<pre>
echo "DEFAULT_VERSIONS= postgresql=9.4" >> /etc/make.conf
</pre>
h2. Install Nginx
* Install nginx and php56
<pre>
pkg install nginx php56
</pre>
* Start and enable nginx at boot:
<pre>
echo 'nginx_enable="YES"' >> /etc/rc.conf
service nginx start
</pre>
* Create a configuration directory to make managing individual server blocks easier
<pre>
mkdir /usr/local/etc/nginx/conf.d
</pre>
* Edit the main nginx config file:
<pre>
vi /usr/local/etc/nginx/nginx.conf
</pre>
#* And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
<pre>
#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;
}
</pre>
h3. Configure PHP-FPM
* Configure the default PHP settings
<pre>
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
</pre>
* Edit the php config file:
<pre>
vi /usr/local/etc/php.ini
</pre>
#* And change the following two parameters:
<pre>
upload_max_filesize = 100M
post_max_size = 100M
max_input_time = 600
</pre>
* Edit @/usr/local/etc/php-fpm.conf@:
<pre>
vi /usr/local/etc/php-fpm.conf
</pre>
#* Make the following changes:
<pre>
listen = /var/run/php-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660
</pre>
* Start and enable PHP-FPM at boot:
<pre>
echo 'php_fpm_enable="YES"' >> /etc/rc.conf
service php-fpm start
</pre>
h2. Install Phppgadmin
* Install phppgadmin:
<pre>
pkg install phppgadmin
</pre>
* Now create a file to enable phppgadmin:
<pre>
vi /usr/local/etc/nginx/conf.d/phppgadmin.conf
</pre>
#* And add the following:
<pre>
server {
listen 8080;
# server_name pg.example.com; localhost;
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;
}
}
</pre>
* Restart nginx:
<pre>
service nginx restart
</pre>
* Now open a web browser and go to http://pg.example.com:8080 to use phpPgAdmin.
*NOTE*: I needed to edit the phpPgAdmin config file
<pre>
vi /usr/local/www/phpPgAdmin/conf/config.inc.php
</pre>
* And change the extra_login_security parameter to false:
<pre>
$conf['extra_login_security'] = false;
</pre>