GNU/Linux >> Linux の 問題 >  >> Debian

Apacheと無料でInvoicePlaneをインストールする方法Debian11でSSL証明書を暗号化する

InvoicePlaneは、見積もり、請求書、クライアント、および支払いを管理するための無料のオープンソースのセルフホストアプリケーションです。多くの組織やフリーランサーが支払いや請求書を管理するために使用しています。 InvoicePlaneの機能を向上させるのに役立つカスタムテンプレート、テーマ、およびその他のツールを提供します。また、複数の言語と、Paypal、Stripe、さらにはCoinbaseを介したビットコインなどの複数の支払いプロバイダーもサポートしています。

このチュートリアルでは、Debian11にApacheを使用してInvoicePlaneをインストールする方法を示します。

前提条件
  • Debian11を実行しているサーバー。
  • サーバーIPで指定された有効なドメイン名。
  • ルートパスワードはサーバーで構成されています。

Apache、PHP、およびMariaDBをインストールします

まず、Apache Webサーバー、MariaDBデータベースサーバー、PHP、およびその他の必要なPHP拡張機能をサーバーにインストールする必要があります。次のコマンドを実行して、それらすべてをインストールできます。

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

すべてのパッケージがインストールされたら、PHP構成ファイルを編集し、デフォルト設定を変更します。

nano /etc/php/7.4/apache2/php.ini

次の行を変更します:

memory_limit = 256M
upload_max_filesize = 128M
max_execution_time = 360
date.timezone = UTC

ファイルを保存して閉じてから、Apacheサービスを再起動して変更を適用します。

systemctl restart apache2

InvoicePlaneのデータベースを作成する

次に、MariaDBのインストールを保護し、InvoicePlaneのデータベースとユーザーを作成する必要があります。

まず、次のコマンドを使用してMariaDBのインストールを保護します。

mysql_secure_installation

以下に示すように、すべての質問に答えてください。

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

次に、次のコマンドを使用してMariaDBシェルに接続します。

mysql -u root -p

接続したら、次のコマンドを使用してInvoicePlaneのデータベースとユーザーを作成します。

MariaDB [(none)]> CREATE DATABASE invplanedb;
MariaDB [(none)]> CREATE USER 'invplane'@'localhost' IDENTIFIED BY 'password';

次に、次のコマンドを使用して、InvoicePlaneにすべての権限を付与します。

MariaDB [(none)]> GRANT ALL PRIVILEGES ON invplanedb.* TO 'invplane'@'localhost';

次に、FLUSH PRIVILEGESコマンドを実行して、特権テーブルがMariaDBによって再ロードされるようにします。

MariaDB [(none)]> FLUSH PRIVILEGES;

最後に、MariaDBシェルを終了します:

MariaDB [(none)]> EXIT

InvoicePlaneをインストール

まず、次のコマンドを使用して最新バージョンのInvoicePlaneをダウンロードします。

wget -c -O v1.5.11.zip https://invoiceplane.com/download/v1.5.11

ダウンロードが完了したら、InvoicePlaneのディレクトリを作成し、ダウンロードしたファイルをInvoicePlaneディレクトリ内に抽出します。

mkdir /var/www/html/invoiceplane
unzip v1.5.11.zip -d /var/www/html/invoiceplane

次に、InvoicePlaneディレクトリに移動し、構成ファイルと.htaccessファイルの名前を変更します。

cd /var/www/html/invoiceplane
cp ipconfig.php.example ipconfig.php
cp htaccess .htaccess

次に、次のコマンドを使用してipconfig.phpファイルを編集します。

nano ipconfig.php

以下に示すように、WebサイトのURLとデータベースの設定を定義します。

IP_URL=http://invoice.example.com
DB_HOSTNAME=localhost
DB_USERNAME=invplane
DB_PASSWORD=password
DB_DATABASE=invplanedb
DB_PORT=3306

次に、InvoicePlaneディレクトリに適切な権限と所有権を設定します。

chown -R www-data:www-data /var/www/html/invoiceplane/
chmod -R 755 /var/www/html/invoiceplane/

InvoicePlane用にApacheを構成する

次に、InvoicePlane用のApache仮想ホスト構成ファイルを作成する必要があります。次のコマンドで作成できます:

nano /etc/apache2/sites-available/invoiceplane.conf

次の行を追加します:

<VirtualHost *:80>
     ServerAdmin [email protected]
     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>

ファイルを保存して閉じてから、次のコマンドを使用してApache仮想ホストをアクティブ化し、モジュールを書き換えます。

a2ensite invoiceplane.conf
a2enmod rewrite

次に、Apacheサービスを再起動して、構成の変更を適用します。

systemctl restart apache2

Apacheのステータスを確認するには、次のコマンドを実行します。

systemctl status apache2

次の出力が得られます:

? 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...

InvoicePlaneWebUIにアクセス

次に、Webブラウザーを開き、URL http://invoice.example.comを使用してInvoicePlaneWebインターフェースにアクセスします。 。次のページが表示されます:

セットアップをクリックします ボタン。言語選択ページが表示されます:

言語を選択して、続行をクリックします ボタン。前提条件のページが表示されます:

続行をクリックします ボタン。次のページが表示されます:

続行をクリックします ボタン。次のページが表示されます:

続行をクリックします ボタン。次のページが表示されます:

管理者ユーザーアカウント情報とアドレスを入力し、続行をクリックします ボタン。 InvoicePlaneをインストールすると、次のページが表示されます。

ログインをクリックします ボタン。次のページが表示されます:

管理者のユーザー名とパスワードを入力し、ログインをクリックします ボタン。次のページにInvoicePlaneダッシュボードが表示されます。

SSLを暗号化して安全なInvoicePlane

Let'sEncryptSSLを使用してWebサイトを保護することは常に良い考えです。 SSLをインストールして管理するには、Certbotクライアントをインストールする必要があります。次のコマンドでインストールできます:

apt-get install python3-certbot-apache -y

Certbotをインストールしたら、次のコマンドを実行して、Let'sEncryptSSLでWebサイトを保護します。

certbot --apache -d invoice.example.com

以下に示すように、メールアドレスを提供し、利用規約に同意するよう求められます。

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): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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

次に、以下に示すように、HTTPトラフィックをHTTPSにリダイレクトするかどうかを選択します。

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

2と入力し、Enterキーを押して、WebサイトにLet'sEncryptSSLをインストールします。

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
結論

おめでとう!これで、Apacheを使用してInvoicePlaneを正常にインストールし、Debian 11にSSLを暗号化しましょう。これで、InvoicePlaneを会社に実装し、Webブラウザから支払いと請求書の管理を開始できます。


Debian
  1. ApacheでTikiWikiをインストールし、Debian10でSSLを暗号化する方法

  2. ApacheでAutomadCMSをインストールし、Debian10で暗号化する方法

  3. ElkArteフォーラムをApacheでインストールし、Debian10で暗号化する方法

  1. Nginxを使用してOpenCartをインストールし、Debian10で暗号化する方法

  2. Drupal 9をNginxでインストールし、Debian10でSSLを暗号化する方法

  3. ElkArteフォーラムをApacheでインストールし、CentOS8でSSLを暗号化する方法

  1. ApacheでJoomlaをインストールし、Debian10でSSLを暗号化する方法

  2. Apacheと無料のLetsEncryptSSLを使用してUbuntu20.04にConcrete5CMSをインストールする方法

  3. DrupalをApacheでインストールし、Debian11でSSLを暗号化する方法