웹사이트 검색

Apache 및 무료로 InvoicePlane을 설치하는 방법 Debian 11에서 SSL 인증서를 암호화하자


이 페이지에서

  1. 전제 조건
  2. Apache, PHP 및 MariaDB 설치
  3. InvoicePlane용 데이터베이스 생성
  4. InvoicePlane 설치
  5. InvoicePlane용 Apache 구성
  6. InvoicePlane 웹 UI 액세스
  7. Lets Encrypt SSL로 안전한 InvoicePlane\n
  8. 결론

InvoicePlane은 견적, 송장, 고객 및 결제를 관리하기 위한 무료 오픈 소스 자체 호스팅 애플리케이션입니다. 많은 조직과 프리랜서가 지불 및 송장을 관리하는 데 사용합니다. InvoicePlane의 기능을 향상시키는 데 도움이 되는 사용자 지정 템플릿, 테마 및 기타 도구를 제공합니다. 또한 여러 언어와 Paypal, Stripe 또는 심지어 Coinbase를 통한 Bitcoin과 같은 여러 결제 제공업체를 지원합니다.

이 자습서에서는 Debian 11에서 Apache와 함께 InvoicePlane을 설치하는 방법을 보여줍니다.

전제 조건

  • Debian 11을 실행하는 서버.\n
  • 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
  • 루트 암호는 서버에서 구성됩니다.\n

Apache, PHP 및 MariaDB 설치

먼저 Apache 웹 서버, 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

아래와 같이 웹사이트 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 
     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...

InvoicePlane 웹 UI에 액세스

이제 웹 브라우저를 열고 URL http://invoice.example.com을 사용하여 InvoicePlane 웹 인터페이스에 액세스하십시오. 다음 페이지가 표시됩니다.

설정 버튼을 클릭합니다. 언어 선택 페이지가 표시됩니다.

언어를 선택하고 계속 버튼을 클릭합니다. 전제 조건 페이지가 표시되어야 합니다.

계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

관리자 사용자 계정 정보, 주소를 제공하고 계속 버튼을 클릭합니다. InvoicePlane이 설치되면 다음 페이지가 표시됩니다.

로그인 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

관리자 사용자 이름과 비밀번호를 입력한 다음 로그인 버튼을 클릭합니다. 다음 페이지에 InvoicePlane 대시보드가 표시되어야 합니다.

Lets Encrypt SSL로 안전한 InvoicePlane

Lets Encrypt SSL로 웹 사이트를 보호하는 것은 항상 좋은 생각입니다. SSL을 설치하고 관리하려면 Certbot 클라이언트를 설치해야 합니다. 다음 명령으로 설치할 수 있습니다.

apt-get install python3-certbot-apache -y

Certbot이 설치되면 다음 명령을 실행하여 Lets Encrypt SSL로 웹 사이트를 보호하십시오.

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 키를 눌러 웹사이트에 Lets Encrypt SSL을 설치합니다.

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와 Lets Encrypt SSL을 Debian 11에 성공적으로 설치했습니다. 이제 회사에서 InvoicePlane을 구현하고 웹 브라우저에서 결제 및 송장 관리를 시작할 수 있습니다.