【发布时间】:2013-01-04 21:31:21
【问题描述】:
背景:
我想在运行 nginx 的 Ubuntu 服务器上设置 Bugify。我按照说明安装了依赖项,安装成功。一旦我输入我的许可证密钥并单击“安装 Bugify”,它就会重定向到 http://dev.mysite.com/login?new,而我看到的唯一内容是 404 Not Found。
我知道 nginx 不受官方支持,但根据support forum 应该可以运行它。
问题:
在 webapp 的公共目录中有一个带有重写规则的 .htaccess 文件,我猜导致 404 错误的问题是 nginx 无法使用 .htaccess 文件,所以我必须转换将规则重写为 nginx 语法。
我不太熟悉 apache 的重写规则,所以我需要一些帮助来解决这个问题。
.htaccess 文件的内容是:
# Rewriting
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
我使用this tool 来转换规则,但是- 标志出现了一些问题。
#ignored: "-" thing used or unknown variable in regex/rew
提前致谢!
【问题讨论】:
-
转换器“忽略”的破折号表示不重写匹配请求。
标签: apache mod-rewrite nginx