2017-02-11 25 views
0

我在heroku中託管一個網站,並在雲主機中使用nginx作爲代理。如何使nginx緩存像清漆一樣?

在我的雲主機,我定義的:

## /etc/nginx/sites-available/default 
server { 
charset utf-8; 
listen 80; 

server_name mywebsite.com www.mywebsite.com; 

location /api { 
    proxy_pass http://mywebsite-api.herokuapp.com; 
} 

location /auth { 
    proxy_pass http://mywebsite-api.herokuapp.com; 
} 

location/{ 
    fastcgi_cache CACHE_KEY; 
    fastcgi_cache_valid 200 60m; 

    proxy_pass http://mywebsite-fe.herokuapp.com; 
} 
} 

## in /etc/nginx/nginx.conf 
....... 
http { 

    fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=CACHE_KEY:100m inactive=60m; 
    fastcgi_cache_key "$scheme$request_method$host$request_uri"; 
    ..... 

我想在nginx的靜態內容,如清漆。我如何使用nginx與heroku的代理來做到這一點?

感謝您的支持。

回答

0

將fastcgi_更改爲proxy_。 fastcgi_版本是針對php-fpm的。