Write Freely
```
useradd -r -m -d /srv/writefreely -s /bin/bash writefreely
usermod -a -G www-data writefreely
su - writefreely
```
download
```
wget https://github.com/writefreely/writefreely/releases/download/v0.15.0/writefreely_0.15.0_linux_amd64.tar.gz
tar xvzf writefreely_0.15.0_linux_amd64.tar.gz
mv writefreely dominio.com
```
EXIT
Install Maria DB
```
apt install mariadb-server
mysql -u root -p
CREATE DATABASE writefreely;
GRANT ALL PRIVILEGES ON writefreely.* TO 'username'@'localhost' IDENTIFIED BY 'yoursimplepass';
```
EXIT
Generate config
```
su - writefreely
cd dominio.com
./writefreely --create-config
```
In the generated file, we will modify the following data:
username = usuarioqueelijas
password = contraseñaqueelijas
database = writefreely
site_name = Título del blog
site_description = Descripción del blog
host = https://dominio.com
default_visibility = public
Once the file is modified we save it (control + X, and we give it to itself). Then we type the following codes to generate the encryption key and the administrator user.
```
./writefreely db init
./writefreely keys generate
./writefreely --create-admin usname:simple password
We will create the service in Systemd and add its content from the root user (you have to exit the writefreely user, if you don't know it's just writing- exit):
```
nano /etc/systemd/system/writefreely.service
```
[Unit]
Description=WriteFreely Instance
After=syslog.target network.target mysql.service
[Service]
Type=simple
StandardOutput=syslog
StandardError=syslog
User=writefreely
Group=www-data
WorkingDirectory=/srv/writefreely/dominio.com
ExecStart=/srv/writefreely/dominio.com/writefreely
Restart=always
[Install]
WantedBy=multi-user.target
After this we save the file (control + X, and give it to itself) and continue:
```
systemctl daemon-reload
systemctl start writefreely
systemctl enable writefreely
```
Now we will start a very important part, configure the Nginx:
```
apt install nginx certbot python3-certbot-nginx
nano /etc/nginx/sites-available/writefreely.conf
```
With the last code we have created a file where we will write the following, remembering to change domain.com for your domain:
server {
listen 80;
listen [::]:80;
server_name example.com;
gzip on;
gzip_types
application/javascript
application/x-javascript
application/json
application/rss+xml
application/xml
image/svg+xml
image/x-icon
application/vnd.ms-fontobject
application/font-sfnt
text/css
text/plain;
gzip_min_length 256;
gzip_comp_level 5;
gzip_http_version 1.1;
gzip_vary on;
location ~ ^/.well-known/(webfinger|nodeinfo|host-meta) {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
}
location ~ ^/(css|img|js|fonts)/ {
root /srv/writefreely/example.com/static;
# Optionally cache these files in the browser:
# expires 12M;
}
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
}
}
We save the file and enable it:
```
cd /etc/nginx/sites-enabled/
ln -s ../sites-available/writefreely.conf
nginx -t
systemctl reload nginx
```
And to finish, we go with the certbot:
```
apt install -y certbot python3-certbot-nginx
certbot
```
location ~ ^/(css|img|js|fonts)/ {
root /srv/writefreely/domain.com/static;
# Optionally cache these files in the browser:
Views: 15