Jirafeau

Your own wetransfer with Jirafeau

JIRAFEAU

This time we are going to talk about how to create your own wetransfer with jirafeau on Debian 11, a very powerful opensource software with a basic API that will allow you to automate many tasks.

The first thing is to update your system

apt-get update

apt-get upgrade

init 6

Once updated we will install the following software

apt-get  install nginx php php-fpm certbot git

And we will enable the nginx and php-fpm services

systemctl enable --now nginx.service php7.4-fpm.service

Next we will request the SSL certificate with certbot

certbot certonly --webroot -m [email protected] -d tudominio --agree-tos

When it asks for the webroot, enter /var/www/html

If everything goes well, you will find the files in /etc/letsencrypt/live/yourdomain/

Once this is done, we will configure nginx by deleting the default site

rm /etc/nginx/sites-enabled/default

And now we create our site

nano /etc/nginx/sites-available/tudominio.conf

Pasting the following content, of course, replacing your domain name

server {
listen 80;
listen [::]:80;
server_name tudominio.com;
return 301 https://tudominio.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name tudominio.com;
root /var/www/html/jirafeau;
index index.php;

ssl_certificate /etc/letsencrypt/live/tudominio.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tudominio.com/privkey.pem;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

Now we create the symbolic link to activate it

ln -s /etc/nginx/sites-available/tudominio.conf /etc/nginx/sites-enabled/

We check that there are no errors in the configuration

nginx -t

And we recharge it

systemctl reload nginx.service

We will continue with the download and installation of Jirafeau, note that we first create the directory that we gave in the configuration file.

mkdir /var/www/html/jirafeau
git clone https://gitlab.com/mojo42/Jirafeau.git /var/www/html/jirafeau

We will also create the directory where the files will be stored outside of our webroot so that it is not accessible from the web server, for example, /var/data/jirafeau

mkdir -p /var/data/jirafeau

And we make www-data the owner of both this directory and the directory where it stores the configuration.

chown -R www-data:www-data /var/www/html/jirafeau/lib /var/data/jirafeau

Now you can access it from your browser via https://yourdomain.com, having to first enter the password you want for web administration. In the next step, enter the base address, that is, https://yourdomain.com/ and the directory where the data will be /var/data/jirafeau/. We continue and after that it will work with the basic options that you have created in the file

/var/www/html/jirafeau/lib/config.local.php

What options can we use here?

If we edit the file

cat /var/www/html/jirafeau/lib/config.original.php

We will be able to see all the available alternatives that we can copy and paste into our production file. It is in English but each option is very easy and intuitive. For example, if you want to upload files requiring a password, you just have to go to your configuration file and add the password as follows:

'upload_password' =>
array (
'password'
),

You can add any password you want as indicated in the commented file. The options are many and very complete.

What about the API?

You can find the info at https://yourdomain.com/script.php, where you even have a bash script. Just copy the content into a .sh file such as testapi.sh and give it execution permission chmod +x testapi.sh, then run it:

./testapi.sh

And he will give us back the help

NOTE!!!! One detail is missing, we edit the testapi.sh file and we must add https:// in JIRAFEAU_URL before our domain.

FINALLY

Certbot already includes in this version the cron to auto-renew, but it will fail because in the certificate request we told it that our webroot is /var/www/html/ and we have installed it in /var/www/html/jirafeau/ , in this case we have to edit the file:

nano /etc/letsencrypt/renewal/tudominio.conf

and in the [[webroot_map]] section we add the directory so that it looks like this:

tudominio.com = /var/www/html/jirafeau

We save and the autorenew will no longer fail. We can check it with:

certbot renew --dry-run

You know, if you have any questions, write a comment.

TL.

Thank you for reading our posts.

No hay comentarios

Comenta la entrada