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

加载更多搜索结果...

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

如何在 Ubuntu 20.04 上使用 Lets Encrypt SSL 安装 TYPO3 CMS

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

本教程适用于这些操作系统版本

  • Ubuntu 20.04(Focal Fossa)
  • Ubuntu 14.04 LTS(Trusty Tahr)

在此页

  1. 先决条件
  2. 开始
  3. 安装 LAMP 服务器
  4. 为 TYPO3 创建数据库
  5. 安装 TYPO3 CMS
  6. 为 TYPO3 配置 Apache
  7. 访问 TYPO3 CMS
  8. 使用 Lets Encrypt 保护 TYPO3
  9. 结论

TYPO3 是一个用 PHP 编写的免费开源内容管理系统。它是一个企业级 CMS,将开源代码与可靠性和真正的可扩展性相结合。它在 Web 服务器上运行,支持多种操作系统,包括 Windows、Linux、macOS 等。它是一个简单、响应迅速、移动就绪且安全的 CMS,无需编写任何代码即可轻松定制和扩展。它是让您的网站快速启动和运行的非常受欢迎且绝佳的选择。

在本教程中,我们将向您展示如何在 Ubuntu 20.04 上安装带有 Apache Web 服务器的 TYPO3 CMS 和 Lets Encrypt SSL。

先决条件

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

入门

首先,建议使用最新版本更新您的系统包。您可以通过运行以下命令来更新所有包:

apt-get update -y

一旦所有包都是最新的,您就可以继续下一步。

安装 LAMP 服务器

接下来,您需要在服务器中安装 Apache 网络服务器、MariaDB、PHP 和其他 PHP 扩展。您可以使用以下命令安装所有这些:

apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-gmp php-curl php-intl php-mbstring php-xmlrpc php-mysql php-gd php-xml php-cli php-zip curl git gnupg2 -y

安装所有包后,编辑 php.ini 文件并更改一些推荐设置:

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

更改以下行:

memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 360
max_input_vars = 1500
date.timezone = Asia/Kolkata

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

systemctl restart apache2

为 TYPO3 创建数据库

接下来,您需要为 TYPO3 创建数据库和用户。首先,使用以下命令登录到 MariaDB shell:

mysql

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

MariaDB [(none)]> CREATE DATABASE typo3db;
MariaDB [(none)]> CREATE USER ''@'localhost' IDENTIFIED BY 'password';

接下来,使用以下命令将所有权限授予 typo3db:

MariaDB [(none)]> GRANT ALL ON typo3db.* TO 'typo3'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

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

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

此时,您的 MariaDB 数据库已配置完毕。

安装 TYPO3 CMS

首先,您需要从他们的官方网站下载最新版本的 TYPO3。您可以使用 curl 命令下载它:

curl -L -o typo3_src.tgz https://get.typo3.org/10.4.9

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

tar -xvzf typo3_src.tgz

接下来,将提取的目录移动到 Apache web 根目录:

mv typo3_src-10.4.9 /var/www/html/typo3

接下来,使用以下命令给予适当的权限和许可:

chown -R www-data:www-data /var/www/html/typo3
chmod -R 775 /var/www/html/typo3

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

为 TYPO3 配置 Apache

接下来,创建一个 Apache 虚拟主机配置文件来托管 TYPO3 CMS。您可以使用以下命令创建它:

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

添加以下行:

<VirtualHost *:80>
     ServerAdmin 
     DocumentRoot /var/www/html/typo3
     ServerName typo3.example.com
     <Directory /var/www/html/typo3>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

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

a2ensite typo3.conf
a2enmod rewrite

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

systemctl restart apache2

此时,Apache Web 服务器已配置为服务 TYPO3。您现在可以继续下一步。

访问 TYPO3 CMS

现在,打开您的网络浏览器并使用 URL http://typo3.example.com 访问 TYPO3。您应该会看到以下页面:

如果您在新服务器上安装 TYPO3,那么您需要在 TYPO3 网络根目录中创建一个 FIRST_INSTALL 文件。您可以使用以下命令创建它:

touch /var/www/html/typo3/FIRST_INSTALL

接下来,刷新网页。您应该会看到以下页面:

单击未检测到问题,继续安装,您应该会看到以下页面:

提供您的数据库用户名、密码、主机,然后单击“继续”按钮。您应该会看到以下页面:

选择您的 TYPO3 数据库名称并单击继续按钮。您应该会看到以下页面:

接下来,提供您的管理员用户名、密码、站点名称,然后单击“继续”按钮。您将被重定向到 TYPO3 登录页面:

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

使用 Lets Encrypt 保护 TYPO3

建议使用 Lets Encrypt Free SSL 来保护您的网站。首先,安装 Certbot 客户端来安装和管理 SSL。您可以使用以下命令安装它:

apt-get install python3-certbot-apache -y

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

certbot --apache -d typo3.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 typo3.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/typo3-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/typo3-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/typo3-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/typo3.conf to ssl vhost in /etc/apache2/sites-available/typo3-le-ssl.conf

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/typo3.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/typo3.example.com/privkey.pem
   Your cert will expire on 2020-10-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

现在,您可以使用 URL https://typo3.example.com 安全地访问 TYPO3 CMS。

结论

恭喜!您已成功安装 TYPO3 CMS 并在 Ubuntu 20.04 上使用 Lets Encrypt SSL 保护它。您现在可以通过 Web 浏览器轻松创建您的网站和博客。如果您有任何问题,请随时问我。

©2015-2025 Norria support@norria.com