【问题标题】:OpenLitespeed htaccessOpenLitespeed htaccess
【发布时间】:2018-08-10 08:35:13
【问题描述】:

我是 OpenLitespeed 网络服务器的新用户。以前我使用 Apache 作为我的 Web 服务器。现在,我对 OpenLitespeed 中出于安全目的的 .htaccess 感到困惑。

我的 .htaccess 规则在 Apache 中效果很好

IndexIgnore *.css *.js *.png *.jpg
Options -Indexes
ErrorDocument 400 index.php
ErrorDocument 403 index.php
ErrorDocument 404 index.php
ErrorDocument 500 index.php

<Files ~ "\.optl$">
Order allow,deny
Deny from all
</Files>

如何在 OpenLiteSpeed Web Server 中使用此规则?谢谢

【问题讨论】:

  • 我遇到了同样的问题

标签: php apache .htaccess mod-rewrite litespeed


【解决方案1】:

我不确定这是不是正确答案,但我把它放在这里以备不时之需:

OpenLitespeed 以另一种方式支持 .htaccess。您可以从 .htaccess 复制重写规则并粘贴到 OpenLiteSpeed 管理控制台:

https://serverfault.com/questions/538249/does-openlitespeed-support-apache-rewrites

更新:是的,我刚刚测试了它,因为我现在遇到了这个问题。它确实有效。

【讨论】:

    【解决方案2】:

    用于 OpenLitespeed 网络服务器。
    您可以通过Virtual Host -&gt; General -&gt; Customized Error Pages 设置ErrorDocument
    错误代码支持您所需要的一切。例如300 ~ 505 其中包括 400,403,404,500。

    您可以通过Virtual Host -&gt; General -&gt; Index Files

    设置索引文件

    “另一种方式”可能不支持上述两条规则,这就是您需要从网络管理员进行设置的原因。 “另一种方式”只支持重写规则。

    【讨论】:

      【解决方案3】:

      在 openlitespeed 中,您必须将 .htaccess 文件指向虚拟主机。从 openlitespeed 管理员 Klik Virtualhost -> 选择您的虚拟主机,在选项卡 Rewrite 中选中“是”以启用重写,并重写规则插入您的文件 .htaccess 的路径,例如 /usr/local/lsws/yourweb/.htaccess

      然后重启你的 openlitespeed 服务器

      /usr/local/lsws/bin/lswsctrl restart
      

      您可以使用脚本自动安装并支持来自https://github.com/tujuhion/openlitespeed-centos-autoinstall 的多虚拟主机

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-11-10
        • 2020-06-08
        • 2019-06-14
        • 2020-12-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多