Handesk部署教程:从本地开发到生产环境的完整步骤

【免费下载链接】handesk A Powerful Laravel Help Desk and Lead Management App 【免费下载链接】handesk 项目地址: https://gitcode.com/gh_mirrors/ha/handesk

Handesk是一款功能强大的Laravel帮助台和潜在客户管理应用,本教程将带您完成从本地开发环境搭建到生产环境部署的全过程,让您快速拥有一个专业的客户支持系统。

一、准备工作:环境与依赖

在开始部署Handesk之前,请确保您的系统满足以下要求:

  • PHP 7.4+(推荐8.0+)
  • MySQL 5.7+ 或 PostgreSQL 10+
  • Composer
  • Node.js 14+
  • Git

1.1 获取项目代码

首先克隆Handesk仓库到本地:

git clone https://gitcode.com/gh_mirrors/ha/handesk
cd handesk

1.2 安装依赖

使用Composer安装PHP依赖:

composer install --no-dev

安装前端依赖并编译资源:

npm install
npm run production

二、本地开发环境配置

2.1 环境变量设置

复制环境变量示例文件并修改:

cp .env.example .env

编辑.env文件,配置数据库连接信息:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=handesk
DB_USERNAME=root
DB_PASSWORD=your_password

2.2 数据库迁移与种子数据

运行数据库迁移创建必要的表结构:

php artisan migrate

生成应用密钥并填充测试数据:

php artisan key:generate
php artisan db:seed

2.3 启动本地开发服务器

使用Artisan命令启动内置服务器:

php artisan serve

访问 http://localhost:8000 即可看到Handesk的登录界面。默认管理员账号:admin@handesk.test,密码:password

三、生产环境部署

3.1 服务器准备

推荐使用以下配置的服务器:

  • 2核CPU
  • 4GB内存
  • 20GB SSD存储
  • Ubuntu 20.04 LTS

安装必要的系统依赖:

sudo apt update
sudo apt install -y nginx mysql-server php-fpm php-mysql php-mbstring php-xml php-curl php-zip

3.2 配置Nginx

创建Nginx配置文件:

sudo nano /etc/nginx/sites-available/handesk

添加以下配置(替换your_domain.com为您的域名):

server {
    listen 80;
    server_name your_domain.com;
    root /var/www/handesk/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/php7.4-fpm.sock;
    }
}

启用站点并重启Nginx:

sudo ln -s /etc/nginx/sites-available/handesk /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

3.3 部署应用代码

将代码部署到服务器:

cd /var/www
git clone https://gitcode.com/gh_mirrors/ha/handesk
cd handesk
composer install --no-dev
npm install --production
npm run production

设置正确的文件权限:

sudo chown -R www-data:www-data /var/www/handesk
sudo chmod -R 755 /var/www/handesk/storage

3.4 配置环境变量与数据库

复制并编辑环境变量文件:

cp .env.example .env
nano .env

更新生产环境配置:

APP_ENV=production
APP_DEBUG=false
APP_URL=https://your_domain.com

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=handesk_prod
DB_USERNAME=handesk_user
DB_PASSWORD=strong_password

创建数据库并运行迁移:

mysql -u root -p
CREATE DATABASE handesk_prod;
CREATE USER 'handesk_user'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON handesk_prod.* TO 'handesk_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

php artisan migrate --force
php artisan key:generate

四、功能预览与使用

Handesk提供了丰富的客户支持和潜在客户管理功能,以下是主要界面预览:

4.1 工单管理界面

工单系统是Handesk的核心功能,您可以在这里查看、分配和处理客户支持请求。

Handesk工单管理界面

4.2 潜在客户管理

Handesk的潜在客户管理功能帮助您跟踪和管理销售线索。

Handesk潜在客户列表

4.3 工单详情页面

查看工单详情并与客户进行沟通:

Handesk工单详情

4.4 邮件通知

系统会自动发送工单状态更新邮件给客户:

Handesk邮件通知

五、维护与更新

5.1 定期更新

保持Handesk最新版本以获取新功能和安全修复:

cd /var/www/handesk
git pull
composer install --no-dev
npm run production
php artisan migrate --force

5.2 数据备份

定期备份数据库:

mysqldump -u handesk_user -p handesk_prod > handesk_backup_$(date +%Y%m%d).sql

六、常见问题解决

6.1 权限问题

如果遇到文件权限错误,确保storage和bootstrap/cache目录可写:

sudo chmod -R 775 storage bootstrap/cache
sudo chown -R www-data:www-data .

6.2 邮件配置

.env中配置SMTP邮件服务:

MAIL_MAILER=smtp
MAIL_HOST=smtp.your-email-provider.com
MAIL_PORT=587
MAIL_USERNAME=your-email@example.com
MAIL_PASSWORD=your-email-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=support@your_domain.com
MAIL_FROM_NAME="Handesk Support"

通过以上步骤,您已成功部署Handesk帮助台系统。如需更多高级配置,请参考项目中的config/目录下的配置文件。祝您使用愉快!

【免费下载链接】handesk A Powerful Laravel Help Desk and Lead Management App 【免费下载链接】handesk 项目地址: https://gitcode.com/gh_mirrors/ha/handesk

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐