【问题标题】:nginx rewrite code for ZenPHOTO 1.4.5ZenPHOTO 1.4.5 的 nginx 重写代码
【发布时间】:2013-06-29 00:44:49
【问题描述】:

我的 ZenPHOTO 1.4.5 画廊有以下 Apache 重写规则:

'<IfModule mod_autoindex.c>
    IndexIgnore *
</IfModule>
<IfModule mod_rewrite.c>
    RewriteEngine On  
    RewriteBase /  
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [L]
    RewriteRule ^.*/?$    index.php [L,QSA]  
</IfModule>`

我需要能够将它与 Nginx 一起使用。

谁能帮我转换一下?

提前致谢!

【问题讨论】:

  • 不要用你的解决方案更新问题,而是回答你自己的问题并接受答案,这样问题就结束了。

标签: nginx


【解决方案1】:

现在,我正在使用以下适用于我的规则。

location ~ \.(gif|jpg|png) {
  try_files $uri @img_proxy;
}
location @img_proxy {
  rewrite ^(.*)$ /index.php?$1;
}
location / {
  try_files $uri $uri/ /index.php?$uri;
}

注意:它适用于最新的ZenPHOTO 1.4.5 版本,我没有检查旧版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-29
    • 1970-01-01
    • 2014-03-12
    • 1970-01-01
    • 2014-02-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-22
    相关资源
    最近更新 更多