Come installare InvoicePlane con Apache e il certificato SSL Free Lets Encrypt su Debian 11
Su questa pagina
- Prerequisiti
- Installa Apache, PHP e MariaDB
- Crea un database per InvoicePlane
- Installa InvoicePlane
- Configura Apache per InvoicePlane
- Accedi all'interfaccia utente Web di InvoicePlane
- Proteggi InvoicePlane con Lets Encrypt SSL
- Conclusione
InvoicePlane è un'applicazione gratuita, open source e self-hosted per la gestione di preventivi, fatture, clienti e pagamenti. Viene utilizzato da molte organizzazioni e liberi professionisti per gestire i pagamenti e le fatture. Offre modelli personalizzati, temi e altri strumenti che ti aiutano ad aumentare la funzionalità di InvoicePlane. Supporta anche più lingue e più fornitori di pagamento come Paypal, Stripe o persino Bitcoin tramite Coinbase.
In questo tutorial, ti mostreremo come installare InvoicePlane con Apache su Debian 11.
Prerequisiti
- Un server che esegue Debian 11.
- Un nome di dominio valido indicato con l'IP del tuo server.
- Sul server è configurata una password di root.
Installa Apache, PHP e MariaDB
Innanzitutto, dovrai installare il server Web Apache, il server del database MariaDB, PHP e altre estensioni PHP richieste sul tuo server. Puoi installarli tutti eseguendo il seguente comando:
apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql wget unzip php-cli php-zip php-curl -y
Una volta installati tutti i pacchetti, modifica il file di configurazione PHP e modifica le impostazioni predefinite:
nano /etc/php/7.4/apache2/php.ini
Modifica le seguenti righe:
memory_limit = 256M upload_max_filesize = 128M max_execution_time = 360 date.timezone = UTC
Salva e chiudi il file, quindi riavvia il servizio Apache per applicare le modifiche:
systemctl restart apache2
Crea un database per InvoicePlane
Successivamente, dovrai proteggere l'installazione di MariaDB e creare un database e un utente per InvoicePlane.
Innanzitutto, proteggi l'installazione di MariaDB usando il seguente comando:
mysql_secure_installation
Rispondi a tutte le domande come mostrato di seguito:
Set root password? [Y/n] Y Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y
Successivamente, connettiti alla shell MariaDB con il seguente comando:
mysql -u root -p
Una volta connesso, crea un database e un utente per InvoicePlane con il seguente comando:
MariaDB [(none)]> CREATE DATABASE invplanedb;
MariaDB [(none)]> CREATE USER 'invplane'@'localhost' IDENTIFIED BY 'password';
Successivamente, concedi tutti i privilegi a InvoicePlane con il seguente comando:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON invplanedb.* TO 'invplane'@'localhost';
Successivamente, esegui il comando FLUSH PRIVILEGES in modo che la tabella dei privilegi venga ricaricata da MariaDB:
MariaDB [(none)]> FLUSH PRIVILEGES;
Infine, esci dalla shell MariaDB:
MariaDB [(none)]> EXIT
Installa InvoicePlane
Innanzitutto, scarica l'ultima versione di InvoicePlane con il seguente comando:
wget -c -O v1.5.11.zip https://invoiceplane.com/download/v1.5.11
Una volta completato il download, crea una directory per InvoicePlane ed estrai il file scaricato all'interno della directory InvoicePlane:
mkdir /var/www/html/invoiceplane
unzip v1.5.11.zip -d /var/www/html/invoiceplane
Successivamente, vai alla directory InvoicePlane e rinomina il file di configurazione e il file .htaccess:
cd /var/www/html/invoiceplane
cp ipconfig.php.example ipconfig.php
cp htaccess .htaccess
Successivamente, modifica il file ipconfig.php con il seguente comando:
nano ipconfig.php
Definisci l'URL del tuo sito web e le impostazioni del database come mostrato di seguito:
IP_URL=http://invoice.example.com DB_HOSTNAME=localhost DB_USERNAME=invplane DB_PASSWORD=password DB_DATABASE=invplanedb DB_PORT=3306
Quindi, imposta le autorizzazioni e la proprietà appropriate per la directory InvoicePlane:
chown -R www-data:www-data /var/www/html/invoiceplane/
chmod -R 755 /var/www/html/invoiceplane/
Configura Apache per InvoicePlane
Successivamente, dovrai creare un file di configurazione dell'host virtuale Apache per InvoicePlane. Puoi crearlo con il seguente comando:
nano /etc/apache2/sites-available/invoiceplane.conf
Aggiungi le seguenti righe:
<VirtualHost *:80> ServerAdmin DocumentRoot /var/www/html/invoiceplane ServerName invoice.example.com <Directory /var/www/html/invoiceplane/> Options +FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Salvare e chiudere il file quindi attivare l'host virtuale Apache e il modulo di riscrittura con il seguente comando:
a2ensite invoiceplane.conf
a2enmod rewrite
Successivamente, riavvia il servizio Apache per applicare le modifiche alla configurazione:
systemctl restart apache2
Per verificare lo stato di Apache, eseguire il seguente comando:
systemctl status apache2
Otterrai il seguente output:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2022-01-21 08:42:34 UTC; 5s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 15965 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 15970 (apache2) Tasks: 6 (limit: 2341) Memory: 15.1M CPU: 82ms CGroup: /system.slice/apache2.service ??15970 /usr/sbin/apache2 -k start ??15971 /usr/sbin/apache2 -k start ??15972 /usr/sbin/apache2 -k start ??15973 /usr/sbin/apache2 -k start ??15974 /usr/sbin/apache2 -k start ??15975 /usr/sbin/apache2 -k start Jan 21 08:42:34 debian11 systemd[1]: Starting The Apache HTTP Server...
Accedi all'interfaccia utente Web di InvoicePlane
Ora apri il browser web e accedi all'interfaccia web di InvoicePlane utilizzando l'URL http://invoice.example.com. Dovresti vedere la seguente pagina:
Fare clic sul pulsante Imposta. Dovresti vedere la pagina di selezione della lingua:
Seleziona la lingua e fai clic sul pulsante Continua. Dovresti vedere la pagina dei prerequisiti:
Fare clic sul pulsante Continua. Dovresti vedere la seguente pagina:
Fare clic sul pulsante Continua. Dovresti vedere la seguente pagina:
Fare clic sul pulsante Continua. Dovresti vedere la seguente pagina:
Fornisci le informazioni sull'account utente amministratore, l'indirizzo e fai clic sul pulsante Continua. Una volta installato InvoicePlane, dovresti vedere la seguente pagina:
Fare clic sul pulsante Accedi. Dovresti vedere la seguente pagina:
Fornisci il nome utente e la password dell'amministratore, quindi fai clic sul pulsante Accedi. Dovresti vedere la dashboard di InvoicePlane nella pagina seguente:
Proteggi InvoicePlane con Lets Encrypt SSL
È sempre una buona idea proteggere il tuo sito web con Lets Encrypt SSL. Dovrai installare il client Certbot per installare e gestire SSL. Puoi installarlo con il seguente comando:
apt-get install python3-certbot-apache -y
Una volta installato Certbot, esegui il seguente comando per proteggere il tuo sito web con Lets Encrypt SSL:
certbot --apache -d invoice.example.com
Ti verrà chiesto di fornire la tua email e di accettare i termini di servizio come mostrato di seguito:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for invoice.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/invoice-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/invoice-le-ssl.conf Enabling available site: /etc/apache2/sites-available/invoice-le-ssl.conf
Successivamente, seleziona se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Digita 2 e premi Invio per installare Lets Encrypt SSL per il tuo sito web:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/invoice.conf to ssl vhost in /etc/apache2/sites-available/invoice-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://invoice.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=invoice.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/invoice.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/invoice.example.com/privkey.pem Your cert will expire on 2022-04-23. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Conclusione
Congratulazioni! hai installato correttamente InvoicePlane con Apache e Lets Encrypt SSL su Debian 11. Ora puoi implementare InvoicePlane nella tua azienda e iniziare a gestire i pagamenti e le fatture dal browser web.