如何在 Debian 9 上使用 Nginx 安装 InvoicePlane
在此页
- 要求
- 先决条件
- 初始步骤
- 第 1 步 - 安装 PHP 和所需的 PHP 扩展
- 第 2 步 - 安装 MariaDB
- 第 3 步 - 安装 NGINX
- 第 4 步 - 安装 InvoicePlane
- 第 5 步 - 完成 InvoicePlane 设置
- 链接
InvoicePlane 是一款免费的开源发票应用程序。可以在这个 Github 上找到它的源代码。本教程将向您展示如何在全新的 Debian 9(扩展版)系统上安装 InvoicePlane。
要求
- 网络服务器(Apache、NGINX)。本教程将使用 Nginx。
- MySQL 5.5 或更高版本或 MariaDB 的同等版本。
- 安装并激活以下 PHP 扩展的 PHP 7.0、7.1 或 7.2 版:
- php-gd
- php哈希
- php-json
- php-mbstring
- php-mcrypt
- php-mysqli
- php-openssl
- php重新编码
- php-xmlrpc
- php-zlib
先决条件
- 运行 Debian 9 的服务器。
- 具有 sudo 权限的非根用户。
初始步骤
检查您的 Debian 版本:
lsb_release -ds
# Debian GNU/Linux 9 (stretch)
设置时区:
sudo dpkg-reconfigure tzdata
更新您的操作系统包(软件)。这是必不可少的第一步,因为它确保您拥有操作系统默认软件包的最新更新和安全修复程序:
sudo apt update && sudo apt upgrade -y
安装 Debian 操作系统基本管理所需的一些基本软件包:
sudo apt install -y curl wget vim git unzip socat bash-completion apt-transport-https
第 1 步 - 安装 PHP 和所需的 PHP 扩展
InvoicePlane Web 应用程序需要 PHP 版本 7.0 或更高版本。
安装 PHP 以及必要的 PHP 扩展:
sudo apt install -y php-cli php-fpm php-common php-gd php-json php-mbstring php-mysql php-xmlrpc php-recode
要显示在模块中编译的 PHP,您可以运行:
php -m
ctype
curl
exif
fileinfo
. . .
. . .
检查 PHP 版本:
php --version
# PHP 7.0.9-1~deb10u1 (cli) (built: Sep 18 2019 10:33:23) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.0.9-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies
启动并启用 PHP-FPM 服务:
sudo systemctl start php7.0-fpm.service
sudo systemctl enable php7.0-fpm.service
第 2 步 - 安装 MariaDB
安装 MariaDB:
sudo apt install -y mariadb-server
检查 MariaDB 版本:
mysql --version
启动并启用 MariaDB 服务:
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
运行 mysql_secure installation
脚本以提高 MariaDB 安全性并为 MariaDB root
用户设置密码:
sudo mysql_secure_installation
如下图所示回答所有问题:
Enter current password for root (enter for none):
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
以 root 用户身份登录 MariaDB shell:
mysql -u root -p
# Enter password
创建将用于安装 InvoicePlane 的 MariaDB 数据库和用户,并记住凭据:
CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
退出 MariaDB shell:
quit
将 dbname、username 和 password 替换为您自己的名称。
第 3 步 - 安装 NGINX
安装 Nginx 网络服务器:
sudo apt install -y nginx
检查 NGINX 版本:
nginx -v
# nginx version: nginx/1.10.3
启动并启用 Nginx 服务:
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
为 InvoicePlane 配置 NGINX。运行 sudo vim /etc/nginx/sites-available/invoiceplane.conf
并使用以下配置填充文件:
server {
listen 80;
listen [::]:80;
server_name example.com;
root /var/www/InvoicePlane;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
通过将文件链接到 sites-enabled
目录来激活新的 invoiceplane.conf
配置:
sudo ln -s /etc/nginx/sites-available/invoiceplane.conf /etc/nginx/sites-enabled/
测试 NGINX 配置:
sudo nginx -t
重新加载 NGINX:
sudo systemctl reload nginx.service
第 4 步 - 安装 InvoicePlane
下载最新稳定版的 InvoicePlane 并解压缩存档:
sudo mkdir -p /var/www
cd /var/www
sudo curl -O -J -L https://invoiceplane.com/download/v1.5.9
sudo unzip v1.5.9.zip
sudo rm v1.5.9.zip
sudo mv ip invoiceplane
导航到 /var/www/invoiceplane
目录:
cd /var/www/invoiceplane
复制 ipconfig.php.example
文件并将副本重命名为 ipconfig.php:
sudo cp ipconfig.php.example ipconfig.php
打开 ipconfig.php
文件并在其中添加您的 URL:
sudo vim ipconfig.php
# Something like this
IP_URL=http://example.com
将 /var/www/invoiceplane
目录的所有权更改为 www-data:
sudo chown -R www-data:www-data /var/www/InvoicePlane
运行 sudo vim /etc/php.ini
并设置 date.timezone:
date.timezone = Region/City
重启 PHP-FPM 服务:
sudo systemctl restart php7.0-fpm.service
从您的 Web 浏览器运行 InvoicePlane 安装程序并按照说明进行操作:
http://example.com/index.php/setup
安装完成后,您可以使用您在安装期间选择的电子邮件地址和密码登录 InvoicePlane。
如果你想保护你的安装,你可以禁用安装程序。为此,请将 ipconfig.php
文件中的 DISABLE_SETUP=false
行替换为 DISABLE_SETUP=true
。
第 5 步 - 完成 InvoicePlane 设置
InvoicePlane 现已安装和配置,是时候访问其 Web 安装向导了。
打开 Web 浏览器并输入 URL http://example.com。您将被重定向到以下页面:

现在,单击“设置”按钮。您应该会看到以下页面:

接下来,选择语言并单击“继续”按钮。您应该会看到以下页面:

接下来,单击“继续”按钮。您应该会看到以下页面:

在这里,提供您的数据库详细信息,然后单击“重试”按钮。您应该会看到以下页面:

现在,单击“继续”按钮。您应该会看到以下页面:

现在,单击“继续”按钮。您应该会看到以下页面:

现在,提供所有必需的详细信息,然后单击“继续”按钮。安装完成后,您应该会看到以下页面:

现在,单击“登录”按钮以访问 InvoicePlane 管理。
链接
- https://invoiceplane.com/
- https://github.com/InvoicePlane/InvoicePlane