apache and nginx cache

fisher006

Verified User
Joined
Mar 5, 2015
Messages
5
I want use apache with nginx reverse proxy and i want use nginx cache.

I add:

proxy_cache_path /tmp/nginx/cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m;

to

/etc/nginx/nginx.conf

http section

and

/usr/local/directadmin/data/users/user/domains/domain.tld.cust_nginx

proxy_cache my-cache;
proxy_cache_valid 3s;
proxy_no_cache $cookie_PHPSESSID;
proxy_cache_bypass $cookie_PHPSESSID;
proxy_cache_key "$scheme$host$request_uri";

location / section


and i don't have any cache files in /tmp/nginx/cache

what is wrong?
 
Did you change /usr/local/directadmin/data/users/user/domains/domain.tld.cust_nginx manually? If yes, you need to execute a rewrite command for the configs.
 
Did you change /usr/local/directadmin/data/users/user/domains/domain.tld.cust_nginx manually? If yes, you need to execute a rewrite command for the configs.


ok, I rewrite my configs, now:

/usr/local/directadmin/data/users/agrofakt/nginx.conf

location / section looks like:

Code:
        location /
        {
               	# access_log off;
               	proxy_buffering off;
                proxy_pass http://XXX:8080;
               	proxy_set_header X-Client-IP	  $remote_addr;
                proxy_set_header X-Accel-Internal /nginx_static_files;
               	proxy_set_header Host             $host;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_cache my-cache;
                proxy_cache_valid 3s;
                proxy_no_cache $cookie_PHPSESSID;
                proxy_cache_bypass $cookie_PHPSESSID;
                proxy_cache_key "$scheme$host$request_uri";
        }


still no cache in:

/tmp/nginx/cache/
 
Reply to an old thread, but incase somebody needs this....

I think you need to add nginx_proxy_buffering=1 to /usr/local/directadmin/conf/directadmin.conf
 
Back
Top