【问题标题】:Bitnami LAMP stack .htmaccess not workingBitnami LAMP 堆栈 .htmaccess 不工作
【发布时间】:2021-05-16 09:07:26
【问题描述】:

我正在尝试将我的网站迁移到 Google Cloud Platform 中的 Bitnami LAMP 标准堆栈。 在我的旧 Apache 服务器中,我使用 .htaccess 和命令:

AddHandler application/x-httpd-php .html

如果我没有该文件 .htaccess,则网站无法正常运行。 当我将 .htaccess 文件复制到 /htdocs 时,网站停止工作 关于 Bitnami 如何与 .htaccess 一起工作的任何线索? (我有几天的时间试图找到解决方案)

【问题讨论】:

    标签: lamp bitnami


    【解决方案1】:

    这里是 Bitnami 工程师,

    我不知道您使用的 Bitnami LAMP 版本,以及您是否将自定义应用程序部署在 /opt/bitnami/apache2/htdocs 文件夹或任何其他文件夹中,但我们建议您检查 Apache 的配置文件(取决于LAMP 版本以及您如何部署应用程序:/opt/bitnami/apache2/conf/bitnami/、/opt/bitnami/apache2/conf/vhosts/ 或 /opt/bitnami/apps/yourcustomapp/conf /*) 并查看“AllowOverride”参数是否设置为“All”。

    https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride

    确认后,请确保您在浏览您的网站时正在访问这些文件。最后,请查看我们文档中的本指南,其中我们解释了如何将 .htaccess 信息移动到 Apache 的 conf 文件以提高网站的安全性和性能。

    https://docs.bitnami.com/google/infrastructure/lamp/administration/use-htaccess/

    该指南基本上解释了如何将 .htaccess 信息移动到一个 htaccess.conf 文件中,您可以在其中设置相同的规则

    <Directory "your/htdocs/folder">
       AddHandler application/x-httpd-php .html
    </Directory>
    

    将它包含在 Apache 的 conf 文件夹中

    Include "path/to/the/htaccess.conf"
    

    然后重启 Apache

    sudo /opt/bitnami/ctlscript.sh restart apache
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-17
      • 2015-12-22
      • 2023-03-17
      • 2016-02-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多