From 7f389be9836669b0afc56a00e61ef0152f8e6e04 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 30 Jun 2024 21:12:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20240623\347\254\224\350\256\260.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\351\242\234\351\224\220\346\225\217/20240623\347\254\224\350\256\260.md" diff --git "a/\351\242\234\351\224\220\346\225\217/20240623\347\254\224\350\256\260.md" "b/\351\242\234\351\224\220\346\225\217/20240623\347\254\224\350\256\260.md" new file mode 100644 index 0000000..e69de29 -- Gitee From fa8a746f8eb2aece3b2794e6b3fdcccd516cbdbd Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 3 Jul 2024 23:29:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20240701\347\254\224\350\256\260.md" | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 "\351\242\234\351\224\220\346\225\217/20240701\347\254\224\350\256\260.md" diff --git "a/\351\242\234\351\224\220\346\225\217/20240701\347\254\224\350\256\260.md" "b/\351\242\234\351\224\220\346\225\217/20240701\347\254\224\350\256\260.md" new file mode 100644 index 0000000..507fcac --- /dev/null +++ "b/\351\242\234\351\224\220\346\225\217/20240701\347\254\224\350\256\260.md" @@ -0,0 +1,126 @@ +## Apache2配置指南 + +步骤 1: 安装 Apache2 +首先,更新包列表并安装Apache2: + +```bash +sudo apt update +sudo apt install apache2 -y +``` + +步骤 2: 更改 Apache2 监听端口为 8080 +编辑 ports.conf 文件,将监听端口改为 8080: + +```bash +sudo vim /etc/apache2/ports.conf +``` + + +在 Vim 编辑器中,将 Listen 80 改为 Listen 8080,并相应地修改 SSL 端口(如果适用): + +```bash +Listen 8080 + + Listen 4443 + +``` + + +步骤 3: 重启 Apache2 并检查状态 +应用更改后,重启 Apache2 服务并检查其状态: + +```bash +sudo systemctl restart apache2 +sudo systemctl status apache2 +``` + + +步骤 4: 配置虚拟主机 +编辑虚拟主机配置文件 000-default.conf,配置您的域名和服务: + +```bash +sudo vim /etc/apache2/sites-available/000-default.conf +``` + + +修改以下内容以反映您的设置: + +```bash + + ServerName yanizwy.top + ServerAlias abc.yanizwy.top + DocumentRoot /var/www/html + ErrorLog ${APACHE_LOG_DIR}/yanizwy.top_error.log + CustomLog ${APACHE_LOG_DIR}/yanizwy.top_access.log combined + +``` + + +步骤 5: 再次重启 Apache2 并检查状态 +保存更改后,再次重启 Apache2 服务并检查状态: + +```bash +sudo systemctl restart apache2 +sudo systemctl status apache2 +``` + + +步骤 6: 启用 SSL 模块 +为了配置 SSL 证书,首先启用 SSL 模块: + +```bash +sudo a2enmod ssl +``` + + +然后重启 Apache2 服务并检查状态: + +```bash +sudo systemctl restart apache2 +sudo systemctl status apache2 +``` + +步骤 7: 创建 SSL 证书存放目录 +在 /etc/apache2/ 目录下创建一个名为 ssl 的文件夹: + +```bash +sudo mkdir /etc/apache2/ssl +``` + +步骤 8: 加载 SSL 模块 +编辑 apache2.conf,确保 SSL 模块已加载: + +```bash +sudo vim /etc/apache2/apache2.conf +``` + + +在文件末尾添加以下内容: + +```bash +LoadModule ssl_module modules/mod_ssl.so +``` + +步骤 9: 配置 SSL 证书 +编辑 000-default.conf,添加 SSL 证书配置: + +```bash +sudo vim /etc/apache2/sites-available/000-default.conf +``` + + +添加以下内容以启用 SSL 并指定证书和密钥文件路径: + +```bash + + SSLEngine on + SSLCertificateFile /etc/apache2/ssl/yanizwy.top.pem + SSLCertificateKeyFile /etc/apache2/ssl/yanizwy.top.key + +``` + + +步骤 10: 配置安全组 +请确保在您的服务器防火墙或安全组中开放了 8080 和 4443 端口,以便外部访问。 + +请注意,这个修改后的指南假设您已经拥有 SSL 证书(.pem 和 .key 文件),并且需要在适当的位置放置这些文件。此外,确保在进行任何更改之前备份您的配置文件,并在生产环境中谨慎操作。 \ No newline at end of file -- Gitee From 36ae1f0d36469060141a040250d1eff0a5e14d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A2=9C=E9=94=90=E6=95=8F?= <11802462+yan-ruimin-8@user.noreply.gitee.com> Date: Wed, 3 Jul 2024 15:30:11 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E9=A2=9C=E9=94=90=E6=95=8F/20240623=E7=AC=94=E8=AE=B0.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20240623\347\254\224\350\256\260.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 "\351\242\234\351\224\220\346\225\217/20240623\347\254\224\350\256\260.md" diff --git "a/\351\242\234\351\224\220\346\225\217/20240623\347\254\224\350\256\260.md" "b/\351\242\234\351\224\220\346\225\217/20240623\347\254\224\350\256\260.md" deleted file mode 100644 index e69de29..0000000 -- Gitee