如何在Debian 9上使用Nginx安装InvoicePlane

如何在Debian 9上使用Nginx安装InvoicePlane

InvoicePlane是一个免费的开源发票应用程序。它的源代码可以在此Github上找到。本教程将向您展示如何在新的Debian 9(stretch)系统上安装InvoicePlane。

要求

  • WebServer(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特权的非root用户。

初步步骤

检查您的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,用户名和密码。

第3步-安装NGINX

安装Nginx Web服务器:

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

激活新 invoiceplane.conf 通过将文件链接到 sites-enabled 目录:

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。

如果要确保安装安全,可以禁用安装程序。为此,请更换 DISABLE_SETUP=falseDISABLE_SETUP=true 在你的 ipconfig.php 文件。

第5步-完成InvoicePlane设置

现在已安装并配置了InvoicePlane,是时候访问其Web安装向导了。

打开您的Web浏览器,然后输入URL http://example.com。您将被重定向到以下页面:

InvoicePlane Web安装程序

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

选择语言

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

检查系统要求

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

数据库详细信息

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

数据库连接成功

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

创建用户帐号

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

InvoicePlane安装完成

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

登录到InvoicePlane

现在,单击“登录”按钮以访问InvoicePlane管理。

链接

  • https://invoiceplane.com/
  • https://github.com/InvoicePlane/InvoicePlane

资讯来源:由0x资讯编译自HOWTOFORGE,版权归作者所有,未经许可,不得转载
你可能还喜欢