howto install behind a reverse proxy

This commit is contained in:
jorge 2021-05-19 15:57:23 +02:00
parent d9a2cf7549
commit 4d7f7dba72
1 changed files with 43 additions and 11 deletions

View File

@ -32,25 +32,57 @@ More information on [docs](https://listmonk.app/docs).
__________________ __________________
### Binary ### 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 #### prerequisites Debian: system user and PostgreSQL
- install `sudo`
- install PostgreSQL `apt install postgresql` - install PostgreSQL `apt install postgresql`
- create system user with config.toml data for the database: - --create system user with config.toml data for the database:
`adduser listmonk` `adduser listmonkuser`--
- create the postgreSQL database, the user and grant permissions: - create the postgreSQL database, the user and grant permissions:
`su - postgres` and then acces de PostgreSQL console `psql` `su - postgres` and then acces de PostgreSQL console `psql`
``` ```
postgres=# CREATE DATABASE listmonk; postgres=# CREATE DATABASE listmonkdatabase;
postgres=# CREATE USER listmonk WITH PASSWORD 'listmonk'; postgres=# CREATE USER listmonkuser WITH PASSWORD 'listmonkpassword';
postgres=# GRANT ALL PRIVILEGES ON DATABASE listmonk TO listmonk; 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`
```
<VirtualHost *:80>
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/"
</VirtualHost>
```
- enable the proxy module `a2enmod proxy_http` enable the site `a2ensite listmonk.domain.tdl` and restart apache `systemctl reload apache2`
#### proceed to install #### 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). - `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 `./listmonk` and visit `http://localhost:9000`. - Run `sudo -u www-data ./listmonk` and visit `http://listmonk.domain.tdl`
#### after install, fine tunning #### after install, fine tunning
oncen checked it works, stop the process. oncen checked it works, stop the process.