0
我有一个轨道应用程序与子域。为什么NGinX不能重定向到我的缓存文件?
我在我的应用程序更改了默认的缓存位置,这样的模板被写入:
[APP_DIR] /公/缓存/ [子网域]/[路径]
因此,请求:
http://france.mysite.com/recipes.html
将写入:
[my_app]/public/cache/france/recipes.html
这是工作的罚款,该文件被写到服务器上的正确位置。
我的问题是NGinx没有提供这些缓存的文件。
我已经添加了以下到我的nginx的配置:
# catch requests to www and remove the 'www'
server {
server_name www.mysite.com;
rewrite^$scheme://mysite.com$request_uri permanent;
}
server {
server_name mysite.com *.mysite.com;
access_log /home/deploy/mysite/staging/current/log/access.log;
error_log /home/deploy/mysite/staging/current/log/error.log;
root /home/deploy/mysite/staging/current/public;
passenger_enabled on;
rails_env staging;
client_max_body_size 400M;
client_body_buffer_size 128k;
if (-f $request_filename) {
break;
}
# Check/files with index.html
if (-f $document_root/cache/$host/$uri/index.html) {
rewrite (.*) /cache/$host/$1/index.html break;
}
# Check the path + .html
if (-f $document_root/cache/$host/$uri.html) {
rewrite (.*) /cache/$host/$1.html break;
}
# Check directly
if (-f $document_root/cache/$host/$uri) {
rewrite (.*) /cache/$host/$1 break;
}
}
有人能指出哪里我已经错了吗? :/