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;
}
}
有人能指出哪裏我已經錯了嗎? :/