2

我是 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 中使用此规则?谢谢

4

3 回答 3

1

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

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

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

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

于 2017-04-07T02:19:02.670 回答
0

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

您可以设置索引文件Virtual Host -> General -> Index Files

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

于 2018-05-15T15:21:18.053 回答
0

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

并重新启动您的 openlitespeed 服务器

/usr/local/lsws/bin/lswsctrl restart

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

于 2018-08-10T00:35:13.373 回答