【问题标题】:Show maintenance page when .lock file is present存在 .lock 文件时显示维护页面
【发布时间】:2013-04-18 03:27:26
【问题描述】:

伙计们!

我试图弄清楚,如何仅在存在 .lock 文件时显示维护。问题是,我正在为我的项目使用 symfony2。而且我无法让它工作。

我正在尝试做这样的事情(nginx 配置):

location / {
   if (-f $document_root/.lock) {
     rewrite ^ /maintenance last;
     break;
   }
   index app.php;
   try_files $uri @rewriteapp;
}

location @rewriteapp {
  rewrite ^(.*)$ /app.php/$1 last;
}

location ~ ^/.*\.php(/|$) {
  fastcgi_split_path_info ^(.+\.php)(/.*)$;
  include fastcgi_params;
}

页面已显示,但所有静态文件也被重定向到 /maintenance。请帮忙!

【问题讨论】:

    标签: symfony nginx


    【解决方案1】:

    将 if 块移动到 rewriteapp 位置内。

    【讨论】:

    • 是的,这有帮助,但它陷入了无限循环
    • 您可能需要调整 /maintenance 的索引页面,但我猜没有日志。
    • @IlyaDoroshin “另一种方式”是什么?
    • @gondo 不幸的是,那是很久以前的事了.. 找不到任何来源:(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-03
    • 1970-01-01
    • 2022-01-02
    • 1970-01-01
    • 2015-03-13
    • 1970-01-01
    相关资源
    最近更新 更多