在线FTP管理系统部署说明

最后更新时间:2023-12-06 10:24:59

说明

  1. 仅支持PHP7.3 64位版本

  2. 需安装 Swoole Loader 扩展

  3. 在线FTP管理系统前后端分离,需配置前端将请求转发至后端程序,转发配置可见下文Apache/Nginx转发配置说明

  4. 前后端程序可部署在同一服务器内,用端口区分

  5. 登陆 www.apayun.com 在【产品】-【下载中心】选择阿帕云引擎(大陆版)即可下载

  1. 用户可以在用户中心直接进入在线FTP的管理站点文件,不需要使用FTP工具连接

    注意:需要上传比较大的文件,请使用FTP工具上传

容器部署

请使用Centos 7进行部署。

安装docker环境

curl -fsSL http://upload.apayun.com/soft/docker/get-docker.sh | bash

下载docker-compose.yml

wget http://upload.apayun.com/soft/controller/hostftp/docker-compose.yml

#该文件请保存到您指定的目录,文件内容请勿修改,若有更新请访问上述站点重新下载即可。

启动服务

docker-compose -f docker-compose.yml up -d

有如下提示表示部署成功,访问:http://本机ip

Creating 阿帕云ftp ... done
Creating php-nts  ... done

更新须知

请先关闭服务,删除本地缓存的镜像,然后再从服务器下载最新镜像来启动服务。

#关闭服务
docker-compose -f docker-compose.yml down
  1. 查看本地已有镜像
[root@localhost ~]# docker images
REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE
hub.apayun.com/library/php        7.3-nts             7f21e8116b62        15 minutes ago      103MB
hub.apayun.com/library/zkeysftp   1.0.0               780603198b1b        4 days ago          34.1MB
  1. 删除一个镜像
docker image rm -f 7f21e8116b62 # -f后面指定IMAGE ID
  1. 删除所有镜像

若您的服务器上不止阿帕云的两个镜像,请勿执行此命令。

docker image rm -f $(docker images -q )
  1. 启动服务
wget http://upload.apayun.com/soft/controller/hostftp/docker-compose.yml

docker-compose -f docker-compose.yml up -d

Nginx配置示例


 ###前端站点
 server{
     listen             80;                    #监听的端口号
     server_name     localhost; #前端站点访问域名
     root /data/wwwroot/zkeys/html;        #站点的路径

     location / {
         index index.php index.html index.htm;
         if (!-e $request_filename) {
             rewrite ^(.*)$ /index.php?s=$1 last;
         }
     }

     location ~ ^.+\.php {
         fastcgi_pass unix:/tmp/php-cgi.sock;    #根据自己的 php-fpm 配置填写
         fastcgi_index index.php;
         ###配置支持pathinfo
         fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
         fastcgi_param PATH_INFO $fastcgi_path_info;
         fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
     }
     配置一个简单的代理转发,将/api开头的请求转发到8000端口
     location /api/ {
         proxy_pass http://127.0.0.1:8000;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
     }
 }

 ###后端站点
 server{
     listen             8000;                    #监听的端口号
     server_name     127.0.0.1; #后端站点访问域名
     root /data/wwwroot/zkeys/api/public;        #站点的路径

     location / {
         index index.php index.html index.htm;
         if (!-e $request_filename) {
             rewrite ^(.*)$ /index.php?s=$1 last;
         }
     }

     location ~ ^.+\.php {
         fastcgi_pass unix:/tmp/php-cgi.sock;    #根据自己的 php-fpm 配置填写
         fastcgi_index index.php;
         ###配置支持pathinfo
         fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
         fastcgi_param PATH_INFO $fastcgi_path_info;
         fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
     }
 }

Apache配置示例

#前端站点配置
<VirtualHost *:80>
  ServerAdmin webmaster@example.com
  # 替换为自己站点路径
  DocumentRoot "/www/wwwroot/zkeys/html"
  # 替换为自己域名
  ServerName localhost
  ServerAlias localhost
  #转发配置
  ProxyPass  /api  http://127.0.0.1:8000/api
  ProxyPassReverse /api  http://127.0.0.1:8000/api
  #DENY FILES
  <Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
    Order allow,deny
    Deny from all
  </Files>
  #PHP
  <FilesMatch \.php$>
          SetHandler "proxy:unix:/tmp/php-cgi-73.sock|fcgi://localhost"
  </FilesMatch>
  # 替换为自己站点路径
  <Directory "/www/wwwroot/zkeys/html">
    DirectoryIndex index.html
    Options FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>
#后端站点
<VirtualHost *:8000>
  ServerAdmin webmaster@example.com
  # 替换为自己站点路径
  DocumentRoot "/www/wwwroot/zkeys/api/public"
  ServerName 127.0.0.1
  ServerAlias 127.0.0.1
  # 替换为自己站点路径
  <Directory "/www/wwwroot/zkeys/api/public">
    DirectoryIndex index.php
    Options FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
  #DENY FILES
  <Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
    Order allow,deny
    Deny from all
  </Files>
</VirtualHost>

主控配置在线FTP地址

配置位置:【生产】 -【虚拟主机】 -【线路管理】 -【其他设置】 -【在线FTP管理域名】