在 Bitnami lightsail aws 上强制使用 https 流量

在 Bitnami lightsail aws 上强制使用 https 流量

我想确保我做对了,以免搞砸任何事情。根据[bitnami docs found here][1]强制 HTTPS 的规定,我应该转到此文件:

/opt/bitnami/apache2/conf/bitnami/bitnami.conf

当我到达这里时,当前文件包含虚拟主机 80 的内容:

<VirtualHost _default_:80>
DocumentRoot "/opt/bitnami/apache2/htdocs"
<Directory "/opt/bitnami/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
<IfVersion < 2.3 >
Order allow,deny
Allow from all
    </IfVersion>
  <IfVersion >= 2.3 >
 Require all granted
</IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

添加代码后,它会告诉我更新,它看起来像这样:

<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
  RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
<Directory "/opt/bitnami/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
<IfVersion < 2.3 >
Order allow,deny
Allow from all
    </IfVersion>
  <IfVersion >= 2.3 >
 Require all granted
</IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

这样说对吗?[1]https://docs.bitnami.com/bch/apps/wordpress/administration/force-https-apache/

相关内容