如何使用 Apache 安装 ProjectSend 并在 Ubuntu 20.04 上加密 SSL如何使用 Apache 安装 ProjectSend 并在 Ubuntu 20.04 上加密 SSL如何使用 Apache 安装 ProjectSend 并在 Ubuntu 20.04 上加密 SSL如何使用 Apache 安装 ProjectSend 并在 Ubuntu 20.04 上加密 SSL
  • 业务
  • 目标
  • 支持
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容

如何使用 Apache 安装 ProjectSend 并在 Ubuntu 20.04 上加密 SSL

发表 admin at 2025年2月28日
类别
  • 未分类
标签

在此页

  1. 先决条件
  2. 开始
  3. 安装 LAMP 服务器
  4. 为 ProjectSend 创建一个数据库
  5. 下载 ProjectSend
  6. 为 ProjectSend 配置 Apache
  7. 访问 ProjectSend Web 界面
  8. 使用 Lets Encrypt SSL 保护 ProjectSend
  9. 结论

ProjectSend 是一个免费的开源文件和图像共享应用程序,可帮助您在公司和客户之间共享文件。它是一个面向客户端的文件共享工具,允许您在任何服务器上上传和共享无限大小的文件。它是用 PHP 编写的,并使用 MySQL 数据库来存储信息。它提供了一组丰富的功能,包括实时统计、自助注册、自助登录、自定义电子邮件模板等。

在本文中,我们将向您展示如何在 Ubuntu 20.04 上使用 Apache 和 Lets Encrypt SSL 安装 ProjectSend 文件共享应用程序。

先决条件

  • 一台运行 Ubuntu 20.04 的服务器。
  • 用您的服务器 IP 指向的有效域名。
  • 在服务器上配置了根密码。

入门

首先,通过运行以下命令将系统包更新到更新版本:

apt-get update -y

更新所有包后,您可以继续下一步。

安装 LAMP 服务器

首先,您需要为您的服务器安装 Apache、MariaDB、PHP 和其他所需的扩展。您可以使用以下命令安装所有这些:

apt-get install apache2 mariadb-server imagemagick php libapache2-mod-php php-imagick php7.4-common php7.4-mysql php7.4-gd php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl php7.4-bcmath php7.4-gmp

安装所有包后,编辑 php.ini 文件:

nano /etc/php/7.4/apache2/php.ini

更改以下设置:

memory_limit = 512M
upload_max_filesize = 32M
max_execution_time = 300
date.timezone = Asia/Kolkata

保存并关闭文件,然后重新启动 Apache 服务以应用更改:

systemctl restart apache2

完成后,您可以继续下一步。

为 ProjectSend 创建数据库

接下来,您需要为 ProjectSend 创建数据库和用户。

为此,请使用以下命令登录到 MariaDB:

mysql

登录后,使用以下命令创建数据库和用户:

MariaDB [(none)]> create database projectsend;
MariaDB [(none)]> create user identified by 'password';

接下来,使用以下命令授予 projectsend 数据库的所有权限:

MariaDB [(none)]> grant all privileges on projectsend.* to ;

接下来,使用以下命令刷新权限并退出 MariaDB:

MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

完成后,您可以继续下一步。

下载项目发送

接下来,您需要从其官方网站下载最新版本的 ProjectSend。您可以使用以下命令下载它:

wget -O projectsend.zip https://www.projectsend.org/download/387/

下载完成后,使用以下命令解压缩下载的文件:

unzip projectsend.zip -d /var/www/html/projectsend

接下来,将目录更改为提取的目录并重命名默认配置文件:

cd /var/www/html/projectsend/includes
cp sys.config.sample.php sys.config.php

接下来,使用以下命令编辑配置文件:

nano sys.config.php

更改以下设置:

define('DB_DRIVER', 'mysql');

/** Database name */
define('DB_NAME', 'projectsend');

/** Database host (in most cases it's localhost) */
define('DB_HOST', 'localhost');

/** Database username (must be assigned to the database) */
define('DB_USER', 'projectsend');

/** Database password */
define('DB_PASSWORD', 'password');

保存并关闭文件,然后使用以下命令设置适当的权限和所有权:

chown -R www-data:www-data /var/www/html/projectsend
chmod -R 775 /var/www/html/projectsend
chmod 644 /var/www/html/projectsend/includes/sys.config.php

完成后,您可以继续下一步。

为 ProjectSend 配置 Apache

接下来,使用以下命令创建 apache 虚拟主机配置文件:

nano /etc/apache2/sites-available/projectsend.conf

添加以下行:

<VirtualHost *:80>
ServerAdmin 
DocumentRoot /var/www/html/projectsend/
ServerName projectsend.example.com
<Directory /var/www/html/projectsend/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/example.com-error_log
CustomLog /var/log/apache2/example.com-access_log common
</VirtualHost>

保存并关闭文件,然后使用以下命令启用重写模块和虚拟主机配置文件:

a2enmod rewrite
a2ensite projectsend.conf

接下来,重新启动 Apache 服务以应用更改:

systemctl restart apache2

您现在可以使用以下命令检查 Apache 的状态:

systemctl status apache2

您应该看到以下输出:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-06-02 07:11:08 UTC; 5min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 17680 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
   Main PID: 14862 (apache2)
      Tasks: 6 (limit: 2353)
     Memory: 25.0M
     CGroup: /system.slice/apache2.service
             ??14862 /usr/sbin/apache2 -k start
             ??17684 /usr/sbin/apache2 -k start
             ??17685 /usr/sbin/apache2 -k start
             ??17686 /usr/sbin/apache2 -k start
             ??17687 /usr/sbin/apache2 -k start
             ??17688 /usr/sbin/apache2 -k start

Jun 02 07:11:08 ubunt4 systemd[1]: Starting The Apache HTTP Server...

访问 ProjectSend Web 界面

现在,打开 Web 浏览器并使用 URL http://projectsend.example.com 访问 ProjectSend Web 界面。您应该会看到以下页面:

提供您的站点名称、站点 URL、管理员用户名、密码,然后单击“安装”按钮。您应该会看到以下页面:

现在,单击“登录”按钮。您应该会看到以下页面:

提供您的管理员用户名和密码,然后单击“登录”按钮。您应该在以下页面上看到 ProjectSend 仪表板:

使用 Lets Encrypt SSL 保护 ProjectSend

使用 Lets Encrypt SSL 保护您的网站始终是个好主意。首先,您需要安装 Certbot 客户端来安装和管理 SSL。默认情况下,Certbot 包包含在 Ubuntu 默认存储库中,因此您可以使用以下命令安装它:

apt-get install python3-certbot-apache -y

安装 Certbot 后,运行以下命令以使用 Lets Encrypt SSL 保护您的网站:

certbot --apache -d projectsend.example.com

您将被要求提供您的电子邮件并接受服务条款,如下所示:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for projectsend.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/projectsend-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/projectsend-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/projectsend-le-ssl.conf

接下来,选择是否将 HTTP 流量重定向到 HTTPS,如下所示:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

键入 2 并按 Enter 键为您的网站安装 Lets Encrypt SSL:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/projectsend.conf to ssl vhost in /etc/apache2/sites-available/projectsend-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://projectsend.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=projectsend.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/projectsend.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/projectsend.example.com/privkey.pem
   Your cert will expire on 2021-12-23. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

结论

恭喜!您已经在 Ubuntu 20.04 上成功安装了带有 Apache 的 ProjectSend 和 Lets Encrypt SSL。您现在可以从 ProjectSend Web 界面轻松共享文件和图像。

©2015-2025 Norria support@norria.com