From 4d7f7dba722ad33d2a753de52c47c6b13a8fa4cd Mon Sep 17 00:00:00 2001 From: jorge Date: Wed, 19 May 2021 15:57:23 +0200 Subject: [PATCH] howto install behind a reverse proxy --- README.md | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4b39612..9f40a95 100644 --- a/README.md +++ b/README.md @@ -32,25 +32,57 @@ More information on [docs](https://listmonk.app/docs). __________________ ### Binary -#### download an prepare config file - -- Download the [latest release](https://github.com/knadh/listmonk/releases) and extract the listmonk binary. -- `./listmonk --new-config` to generate config.toml. Then, edit the file. #### prerequisites Debian: system user and PostgreSQL +- install `sudo` - install PostgreSQL `apt install postgresql` -- create system user with config.toml data for the database: - `adduser listmonk` +- --create system user with config.toml data for the database: + `adduser listmonkuser`-- - create the postgreSQL database, the user and grant permissions: `su - postgres` and then acces de PostgreSQL console `psql` ``` - postgres=# CREATE DATABASE listmonk; - postgres=# CREATE USER listmonk WITH PASSWORD 'listmonk'; - postgres=# GRANT ALL PRIVILEGES ON DATABASE listmonk TO listmonk; + postgres=# CREATE DATABASE listmonkdatabase; + postgres=# CREATE USER listmonkuser WITH PASSWORD 'listmonkpassword'; + postgres=# GRANT ALL PRIVILEGES ON DATABASE listmonkdatabase TO listmonkuser; ``` + +#### download an prepare config file +- `cd /var/www/` and make the directory `mkdir listmonk` +- `cd listmonk` +- Download the [latest release](https://github.com/knadh/listmonk/releases) and extract the listmonk binary. + ``` + wget https://github.com/knadh/listmonk/releases/download/v1.0.0/listmonk_1.0.0_linux_amd64.tar.gz + wget https://github.com/knadh/listmonk/releases/download/v1.0.0/listmonk_1.0.0_checksums.txt + sha256sum listmonk_1.0.0_linux_amd64.tar.gz + cat listmonk_1.0.0_checksums.txt |grep linux + ``` +- change ownership of files `chown -R www-data:www-data /var/www/listmonk` +- generate config file `sudo -u www-data ./listmonk --new-config` +- edit the config file with the data we created previously and more options `vim /var/www/listmonk/confif.toml` + +#### reverse proxy +- create the apache config to work behind a reverse proxy `/etc/apache2/sites-available/listmonk.doamain.tdl.conf` +``` + + ServerName listmonk.domain.tdl + + ServerSignature Off + + + ErrorLog /var/log/apache2/listmonk.domain.tdl_error.log + TransferLog /var/log/apache2/listmonk.domain.tdl_access.log + LogLevel warn + + ProxyPreserveHost On + ProxyPass "/" "http://127.0.0.1:9000/" + ProxyPassReverse "/" "http://127.0.0.1:9000/" + +``` +- enable the proxy module `a2enmod proxy_http` enable the site `a2ensite listmonk.domain.tdl` and restart apache `systemctl reload apache2` + #### proceed to install -- `./listmonk --install` to setup the Postgres DB (or `--upgrade` to upgrade an existing DB. Upgrades are idempotent and running them multiple times have no side effects). -- Run `./listmonk` and visit `http://localhost:9000`. +- `sudo -u www-data ./listmonk --install` to setup the Postgres DB (or `--upgrade` to upgrade an existing DB. Upgrades are idempotent and running them multiple times have no side effects). +- Run `sudo -u www-data ./listmonk` and visit `http://listmonk.domain.tdl` #### after install, fine tunning oncen checked it works, stop the process.