安装Paymenter
Paymenter是一个开源的财务系统,可以代替WHMCS等一类收费产品。
这篇文件简单介绍一下如何对接VirtFusion实现自动开通虚拟机。
首先我们需要安装Paymenter,以下安装步骤基于Debian12。
安装nginx、mariadb、redis、certbot:
apt -y update apt -y install nginx python3-certbot-nginx mariadb-server redis-server
安装php8.1:
apt -y install curl apt-transport-https ca-certificates lsb-release curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list apt -y update apt -y install php8.1 php8.1-common php8.1-fpm \ php8.1-mysql php8.1-cli php8.1-gd \ php8.1-mbstring php8.1-bcmath php8.1-xml \ php8.1-curl php8.1-zip
如果系统内之前安装了别的php版本,可通过如下命令切换到8.1:
update-alternatives --config php
安装composer:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
配置数据库:
mysql_secure_installation
登录到数据库:
mysql -u root -p
创建用户和数据库:
CREATE USER 'paymenter'@'127.0.0.1' IDENTIFIED BY 'password'; CREATE DATABASE paymenter; GRANT ALL PRIVILEGES ON paymenter.* TO 'paymenter'@'127.0.0.1' WITH GRANT OPTION; FLUSH PRIVILEGES; exit
下载paymenter源码:
mkdir /var/www/paymenter cd /var/www/paymenter curl -Lo paymenter.tar.gz https://github.com/paymenter/paymenter/releases/latest/download/paymenter.tar.gz tar -xzvf paymenter.tar.gz chmod -R 755 storage/* bootstrap/cache/
复制一份配置文件:
cp .env.example .env
安装依赖、生成KEY:
composer install --no-dev --optimize-autoloader php artisan key:generate --force # 此命令仅初次安装需要执行 php artisan storage:link # 此命令仅初次安装需要执行
编辑配置文件:
nano .env
需要改动的配置:
APP_URL=https://shop.example.com DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=paymenter DB_USERNAME=paymenter DB_PASSWORD=password
执行数据库迁移:
php artisan migrate --force --seed
创建管理员账号:
php artisan p:user:create
设置正确的所有者权限:
chown -R www-data:www-data /var/www/paymenter
添加定时任务,请注意这里一定要带-u参数指定www-data用户执行:
crontab -u www-data -e
写入如下配置:
* * * * * php /var/www/paymenter/artisan schedule:run >> /dev/null 2>&1
创建队列服务:
nano /etc/systemd/system/paymenter.service
写入如下配置:
[Unit] Description=Paymenter Queue Worker [Service] User=www-data Group=www-data Restart=always ExecStart=/usr/bin/php /var/www/paymenter/artisan queue:work StartLimitInterval=180 StartLimitBurst=30 RestartSec=5s [Install] WantedBy=multi-user.target
启动并设置开机自启:
systemctl enable --now paymenter.service
新建nginx站点配置文件:
nano /etc/nginx/sites-available/paymenter
写入如下配置:
server { listen 80; listen [::]:80; server_name shop.example.com; root /var/www/paymenter/public; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; } }
启用站点:
ln -s /etc/nginx/sites-available/paymenter /etc/nginx/sites-enabled/paymenter
签发ssl证书:
certbot --nginx
对接VirtFusion
请按照这篇文章先部署好VirtFusion:https://lala.im/8812.html
转到VirtFusion控制面板创建一个API:
名字随意,Access留空:
复制保存KEY:
转到Paymenter-扩展-VirtFusion:
启用扩展并输入你的VirtFusion域名和之前生成的KEY,最后点击保存即可:
接下来创建分类与产品,这里略过不介绍了,产品创建完之后,点击扩展选项卡,选择对应的Package、Hypervisor Group ID,以及设置Number IPs:
PayPal支付网关
Paymenter支持的PayPal支付网关有2个,个人使用建议就用IPN,因为这个配置起来很简单:
转到扩展-PayPal IPN,启用扩展,然后填写你的PayPal账号,一定要勾选Live:
登录你的PayPal,转到卖家工具:https://www.paypal.com/myaccount/preferences/seller-tools
点击及时付款通知:
将通知网址设置为你的Paymenter域名,将接收訊息打开即可:
以上就是我搭建杂货店的完整步骤。
爱你大佬。么么哒
PayPal国号能收国号资金吗,我记得是不能啊
用香港或者美国pp。
lala怎么不用whmcs了