Write Freely
Follow this to the letter and you will have a new WriteFreely Website/Blog
useradd -r -m -d /srv/writefreely -s /bin/bash writefreely
usermod -a -G www-data writefreely
su - writefreely
```
We then we proceed to download the image of Writefreely from Github and unzip it by changing “ domain.com ” for your domain:
```bash
wget https://github.com/writefreely/writefreely/releases/download/v0.15.1/writefreely_0.15.1_linux_amd64.tar.gz
tar xvzf writefreely_0.15.1_linux_amd64.tar.gz
mv writefreely dominio.com
```
EXIT
We install maridb and create the database:
```bash
apt install mariadb-server
mysql -u root -p
CREATE DATABASE writefreely;
GRANT ALL PRIVILEGES ON writefreely.* TO 'username'@'localhost' IDENTIFIED BY 'password';
```
EXIT
Now we generate the configuration of writefreely. Remember that you must change domain.com by your domain:
```bash
su - writefreely
cd domain.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.
```bash
./writefreely db init
./writefreely keys generate
./writefreely --create-admin usuarioqueelijas:contraseñaqueelijas
```
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):
```bash
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:
```bash
systemctl daemon-reload
systemctl start writefreely
systemctl enable writefreely
```
Now we will start a very important part, configure the Nginx:
```bash
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 /var/www/example.com/static;
}
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:
```bash
cd /etc/nginx/sites-enabled/
ln -s ../sites-available/writefreely.conf
nginx -t
systemctl reload nginx
```
And to finish, we go with the certbot:
```bash
apt install -y certbot python3-certbot-nginx
certbot