我有 Let'sEncrypt 提供的免费 SSL 证书,它工作得很好。
但我的目录中有很多文件/etc/apache2/sites-available/
,我想删除/合并其中一些文件,以便那里只有 4 个文件:
/etc/apache2/sites-available/000-default.conf
/etc/apache2/sites-available/mroesler.conf
/etc/apache2/sites-available/firstsnow.conf
/etc/apache2/sites-available/converse.conf
目前我有这么多文件:
michal@ubuntu:~$ sudo ls -lah /etc/apache2/sites-available/
total 36K
drwxr-xr-x 2 root root 4.0K Jul 8 14:50 .
drwxr-xr-x 8 root root 4.0K Jun 16 21:17 ..
-rw-r--r-- 1 root root 1.6K Nov 24 2022 000-default.conf
-rw-r--r-- 1 root root 1.6K Nov 24 2022 000-default-le-ssl.conf
-rw-r--r-- 1 root root 0 Jul 8 14:50 converse.conf
-rw-r--r-- 1 root root 6.2K Oct 1 2020 default-ssl.conf
-rw-r--r-- 1 root root 168 Jun 15 02:58 firstsnow.conf
-rw-r--r-- 1 root root 346 Jun 15 02:25 firstsnow-le-ssl.conf
-rw-r--r-- 1 root root 164 Jun 15 02:59 mroesler.conf
我想移动的内容firstsnow-le-ssl.conf
是:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName firstsnow.dev
ServerAlias www.firstsnow.dev
DocumentRoot /var/www/first
SSLCertificateFile /etc/letsencrypt/live/firstsnow.dev/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/firstsnow.dev/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
进入firstsnow.conf
文件,看起来像这样:
<VirtualHost *:80>
ServerName firstsnow.dev
ServerAlias www.firstsnow.dev
DocumentRoot /var/www/first
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我想将其放在内容下方,内容已经firstsnow.conf
以描述和显示的方式包含在内容中这里。但我不确定,我应该如何处理<IfModule mod_ssl.c>
和</IfModule>
线。我可以不将它们包含在合并firstsnow.conf
文件中吗?
我的 Let'sEncrypt SSL 证书仍然有效吗?
这样的事情会起作用吗?
<VirtualHost *:80>
ServerName firstsnow.dev
ServerAlias www.firstsnow.dev
DocumentRoot /var/www/first
Redirect permanent / https://firstsnow.dev/
</VirtualHost>
<VirtualHost *:443>
ServerName firstsnow.dev
ServerAlias www.firstsnow.dev
DocumentRoot /var/www/first
<If "%{HTTP_HOST} == 'www.firstsnow.dev'">
Redirect permanent / https://firstsnow.dev/
</If>
SSLCertificateFile /etc/letsencrypt/live/firstsnow.dev/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/firstsnow.dev/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
firstsnow.conf
它是否正确 - 作为我删除文件后的内容firstsnow-le-ssl.conf
?