Support #795
Updated by Daniel Curtis over 8 years ago
This is a guide for setting up a self-hosted wallabag instance on an nginx web server using postgresql on FreeBSD 10.
h1. Prepare the Environment
* Before installation of the components, make sure everything is up to date using the following command:
<pre>
pkg update -f && pkg upgrade
</pre>
* Install portmaster:
<pre>
pkg install portmaster
</pre>
---
h1. Install Nginx
* Install Nginx
<pre>
pkg install nginx
</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>
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;
keepalive_timeout 65;
# Load config files from the /etc/nginx/conf.d directory
include /usr/local/etc/nginx/conf.d/*.conf;
}
</pre>
h1. Install PostgreSQL 9.4
* Install PostgreSQL:
<pre>
pkg install postgresql94-{server,client}
</pre>
* Enable PostgreSQL at boot:
<pre>
echo 'postgresql_enable="YES"' >> /etc/rc.conf
</pre>
* Initialize the database:
<pre>
service postgresql initdb
</pre>
* Start PostgreSQL:
<pre>
service postgresql start
</pre>
* Edit the postgres config file:
<pre>
vi /usr/local/pgsql/data/postgresql.conf
</pre>
#* And modify the following:
<pre>
listen_addresses = '*'
</pre>
* Edit the pg_hba config file:
<pre>
vi /usr/local/etc/pgsql/data/pg_hba.conf
</pre>
#* And modify the following:
<pre>
# TYPE DATABASE USER CIDR-ADDRESS METHOD only
# Local connections
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# IPv4 connections:
host all all 192.168.10.0/24 md5
# IPv6 local connections:
host all all 1234::abcd/64 md5
</pre>
* And wrap up by restarting the nginx and postgresql servers:
<pre>
service nginx restart
service postgresql restart
</pre>
* Switch to the pgsql user:
<pre>
su pgsql
</pre>
#* Create the wallabagdb database:
<pre>
createdb wallabagdb
</pre>
#* Then create the wallabaguser user:
<pre>
createuser -Pl --interactive wallabaguser
</pre>
#* Grant all privileges to wallabagdb to wallabaguser:
<pre>
psql template1
GRANT ALL PRIVILEGES ON DATABASE "wallabagdb" to wallabaguser;
\q
</pre>
* Exit from the pgsql user
<pre>
exit
</pre>
h1. Install PHP
* Install PHP 5.6 and other supporting packages:
<pre>
pkg install php56 php56-session php56-ctype php56-dom php56-filter php56-hash php56-simplexml php56-json php56-gd php56-mbstring php56-xml php56-tidy php56-iconv php56-curl php56-gettext php56-tokenizer php56-pdo_pgsql php-composer
</pre>
* 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 modify the memory limit to 2GB:
<pre>
memory_limit = 2G
</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>
* Restart nginx:
<pre>
service nginx restart
</pre>
h1. Install Wallabag
* Clone the latest wallabag version from GitHub:
<pre>
cd /usr/local/www
git clone -b v2 https://github.com/wallabag/wallabag.git
cd wallabag
</pre>
* Then run the two installation commands:
<pre>
env SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
php bin/console wallabag:install --env=prod
</pre>
* Add a *wallabag.example.com server block*:
<pre>
vi /usr/local/etc/nginx/conf.d/wallabag.example.com.conf
</pre>
#* Add the following:
<pre>
server {
listen 80;
server_name wallabag.example.com;
root /usr/local/www/wallabag.example.com;
access_log /var/log/wallabag.example.com-access.log;
error_log /var/log/wallabag.example.com-error.log;
location / {
index index.php index.html index.htm;
}
# For all PHP requests, pass them on to PHP-FPM via FastCGI
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}
}
</pre>
h1. Resources
* http://doc.wallabag.org/en/v2/
* http://doc.wallabag.org/en/v2/user/installation.html