快速开始
在 LiteHTTPD(完整版)上运行 WordPress
Section titled “在 LiteHTTPD(完整版)上运行 WordPress”-
安装 LiteHTTPD(RPM 仓库):
Terminal window curl -s https://rpms.litehttpd.com/setup.sh | bashdnf install openlitespeed-litehttpdsystemctl restart lsws -
在
vhconf.conf中配置虚拟主机:docRoot /var/www/htmlallowOverride 255autoLoadHtaccess 1 -
创建或验证你的 WordPress
.htaccess:# BEGIN WordPressRewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]# END WordPress -
重启 OLS:
Terminal window /usr/local/lsws/bin/lswsctrl restart -
验证完整版功能:
Terminal window # RewriteRule [R=301] 重定向生效curl -I localhost:8088/test-redirect/old-page# 返回 301 Moved Permanently# Header set 生效curl -I localhost:8088/# 显示自定义响应头# Require all denied 生效curl -I localhost:8088/.htaccess# 返回 403 Forbidden
Thin 版本快速开始
Section titled “Thin 版本快速开始”-
将模块复制到 OLS:
Terminal window cp litehttpd_htaccess.so /usr/local/lsws/modules/ -
启用模块:
Terminal window cat >> /usr/local/lsws/conf/httpd_config.conf <<'CONF'module litehttpd_htaccess {ls_enabled 1}CONF -
重启并验证:
Terminal window /usr/local/lsws/bin/lswsctrl restart# Header set 生效curl -I localhost:8088/# 显示自定义响应头# Require all denied 生效curl -I localhost:8088/.htaccess# 返回 403 Forbidden
在 Thin 版本中,RewriteRule [R=301] 将返回 404。如需重定向支持,请使用完整版。