Loading... <div class="tip share">请注意,本文编写于 289 天前,最后修改于 276 天前,其中某些信息可能已经过时。</div> # 前言 Blesta 面板是一款功能强大的托管和账单管理软件,它集成了客户管理、产品管理、订单处理及发票生成等多项功能。它相较 WHMCS 而言最大的特点是授权便宜。本教程将介绍如何在 Ubuntu 22.04 环境手动搭建 Web 环境并安装 Blesta 面板。 Blesta 官网:[https://blesta.com/](https://blesta.com/) # Blesta 官方推荐的环境要求 The following requirements are recommended, and if met will provide a better experience and more full use of available features. 1. PHP version **7.4, 8.1** or **8.2** 2. **PDO**, **pdo\_mysql**, **curl** (version 7.10.5 or later), **openssl** (version 1.1.1a or later), **gmp**, **imap**, **json**, **ldap**, **libxml**,**mailparse**, **iconv**,**mbstring**, **simplexml**, **soap**, **gd**, and **zlib** PHP extensions 3. **MySQL** version **5.7.7**, or **MariaDB** version **10.2.2** or later with **max\_allowed\_packet = 128M or higher**, and **wait\_timeout = 3600** 4. Apache, IIS, or LiteSpeed Web Server 5. **ionCube** PHP loader 6. **memory\_limit** set to 256 MB or greater 7. **max\_input\_vars** set to 10000 or greater (Config options with many options/prices can exceed the default 1000) # LNMP 环境搭建 Nginx 和 MariaDB 的安装及基础配置可参考前篇介绍 LNMP 环境搭建的文章。 <div class="preview"> <div class="post-inser post box-shadow-wrap-normal"> <a href="https://anomoe.me/index.php/archives/1/" target="_blank" class="post_inser_a no-external-link no-underline-link"> <div class="inner-image bg" style="background-image: url(https://image.anomoe.me/images/2024/04/19/cover1.png);background-size: cover;"></div> <div class="inner-content" > <p class="inser-title">基于 Ubuntu 22.04 手动搭建 LNMP 环境</p> <div class="inster-summary text-muted"> 概述本文旨在介绍如何在 Ubuntu 22.04 的系统中搭建和配置基础 LNMP 环境,通过 APT 软件包管理... </div> </div> </a> <!-- .inner-content #####--> </div> <!-- .post-inser ####--> </div> ## 安装 PHP **添加 PPA 源** ```bash add-apt-repository ppa:ondrej/php ``` **更新 APT 缓存** ```bash apt update ``` **安装 PHP 及所需的模组** ```bash apt install php8.2-{fpm,cli,mysql,curl,gmp,imap,ldap,mailparse,mbstring,soap,gd,xml,xmlrpc,zip,opcache,bcmath} -y ``` **启动 PHP-FPM 服务并设置开机自启** ```bash systemctl start php8.2-fpm systemctl enable php8.2-fpm ``` # 配置环境 **创建数据库及用户** ```bash CREATE DATABASE blesta CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; GRANT ALL PRIVILEGES ON blesta_db.* TO 'blesta'@'localhost' IDENTIFIED BY 'password'; ``` **设置 php.ini** ```bash sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 16M/' /etc/php/8.2/fpm/php.ini sed -i 's/post_max_size = 8M/post_max_size = 16M/' /etc/php/8.2/fpm/php.ini sed -i 's/memory_limit = 128M/memory_limit = 256M/' /etc/php/8.2/fpm/php.ini ``` **下载并安装 ionCube** ```bash curl https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz | tar -xz -C /usr/lib/php/20220829 sed -i '$a zend_extension = /usr/lib/php/20220829/ioncube/ioncube_loader_lin_8.2.so' /etc/php/8.2/fpm/php.ini ``` **重启 PHP-FPM 服务** ```bash systemctl restart php8.2-fpm ``` **下载并解压 Blesta** ```bash mkdir /home/wwwroot cd /home/wwwroot wget https://account.blesta.com/client/plugin/download_manager/client_main/download/247/blesta-5.9.3.zip unzip blesta-5.9.3.zip ``` 解压后目录看起来是这样的 `blesta hotfix-php8 LICENSE README.md uploads` **生成 dhparam.pem 文件** ```bash mkdir /etc/nginx/ssl openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 ``` **添加 Nginx 虚拟主机配置** 新建 `/etc/nginx/conf.d/example.com.conf` 文件,并向文件写入以下内容 ```config server { listen 80; listen [::]:80; server_name example.com; return 301 https://$host$request_uri; } server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name example.com; root /home/wwwroot/example.com; index index.php; #enable php location ~ \.php$ { try_files $fastcgi_script_name =404; include fastcgi_params; fastcgi_index index.php; fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; fastcgi_pass unix:/run/php/php-fpm.sock; fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; } #rewrite location / { try_files $uri $uri/ /index.php?$args; } ssl_certificate /etc/nginx/ssl/example.com/ssl.crt; ssl_certificate_key /etc/nginx/ssl/example.com/ssl.key; ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; # about 40000 sessions ssl_session_tickets off; ssl_dhparam /etc/nginx/ssl/dhparam.pem; # intermediate configuration ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305; ssl_prefer_server_ciphers off; # HSTS (ngx_http_headers_module is required) (63072000 seconds) add_header Strict-Transport-Security "max-age=63072000" always; } ``` **重启 Nginx 服务** ```bash systemctl restart nginx ``` 到此,所有 Blesta 面板所需要的环境都已经配置完成,你可以直接访问域名跟着 Blesta 页面的引导进行安装了。 版权声明:本作品采用[知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议](https://creativecommons.org/licenses/by-nc-sa/4.0/)进行许可。 > https://docs.blesta.com/display/user/Requirements > https://blog.chs.pub/p/23-12-throughlampinstallblesta/ 最后修改:2024 年 04 月 22 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 2 如果觉得我的文章对你有用,请随意赞赏