本文介绍了存在.lock文件时显示维护页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们!
我正在尝试找出仅在存在.lock
文件时如何显示维护的方法.问题是,我在项目中使用symfony2.而且我无法正常工作.
I'm trying to figure out, how to show maintenance only when .lock
file is present. The problem is, that I'm using symfony2 for my project. And I can't get it work.
我正在尝试执行以下操作(nginx配置):
I'm trying to do something like this (nginx config):
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.请帮忙!
The page is shown, but all static files are redirected to /maintenance too. Please help!
推荐答案
将if块移至rewriteapp位置内.
Move the if block inside the rewriteapp location.
这篇关于存在.lock文件时显示维护页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!