NginxでForward-Proxyたててキャッシュしてみた

以前nginxでForward-proxy建てる記事を書いたのですが、これにキャッシュを加えてみました。reverse-proxyでよく見る設定です(´ω`) 画像系の静的ファイルをキャッシュします。

あとproxy_cache_pathの部分をramdiskに乗っけてみました。

1
2
3
4
5
6
7
8
# echo "tmpfs /var/cache/nginx tmpfs defaults,noatime,size=100m 0 0" >> /etc/fstab
# mount -a
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# /etc/init.d/nginx restart
nginx を停止中:                                            [  OK  ]
nginx を起動中:                                            [  OK  ]

あとは適当にproxy設定すればいい感じにキャッシュしてくれてると思います。

Comments