drupal-with-nginx icon indicating copy to clipboard operation
drupal-with-nginx copied to clipboard

How to Fix nginx: [emerg] unknown no_cache variable

Open jaypabs opened this issue 11 years ago • 9 comments

I'm trying to integrate this on my ubuntu server, but whenever I test nginx using nginx -t command it always return this error:

nginx: [emerg] unknown "no_cache" variable nginx: configuration file /etc/nginx/nginx.conf test failed

How to fix this one?

jaypabs avatar Jan 26 '14 07:01 jaypabs

Are you sure that you have the apps/drupal/map_cache.conf file? That's where that variable is defined?

perusio avatar Jan 27 '14 00:01 perusio

Yes, there is map_cache.conf in drupal's folder. But I can't see that is was included in drupal_boost.conf. How do you call that config file?

jaypabs avatar Jan 27 '14 00:01 jaypabs

Now I know. I should include it in nginx.conf. What I did it copy only apps/drupal folder. Because I already have nginx.conf configuration. And I only need your script to run on drupal since I also have a lot of WordPress site on this same server.

Is it necessary to use all of your config?

jaypabs avatar Jan 27 '14 01:01 jaypabs

No just copy the line that include that file for a start and see if it fixes the problems. Bear in mind that if you want to use microcaching you need to include that line also.

perusio avatar Jan 27 '14 01:01 perusio

I tried to use all of your config but I now received this error:

nginx: [emerg] could not build the types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 32 nginx: configuration file /etc/nginx/nginx.conf test failed

jaypabs avatar Jan 27 '14 01:01 jaypabs

Increase that value. The date directive is commented out in nginx.conf. Uncomment it. Le 27 janv. 2014 02:37, "jaypabs" [email protected] a écrit :

I tried to use all of your config but I now received this error:

nginx: [emerg] could not build the types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 32 nginx: configuration file /etc/nginx/nginx.conf test failed

— Reply to this email directly or view it on GitHubhttps://github.com/perusio/drupal-with-nginx/issues/150#issuecomment-33337153 .

perusio avatar Jan 27 '14 01:01 perusio

I can't find either types_hash_max_size or types_hash_bucket_size in nginx.conf.

jaypabs avatar Jan 27 '14 01:01 jaypabs

I found this one map_hash_bucket_size instead of types_hash_max_size or types_hash_bucket_size. I already uncomment it and increase it to 2048 without luck.

jaypabs avatar Jan 27 '14 01:01 jaypabs

Sorry. You must be using an old version of Nginx. Anyway the directive is here. Try.

types_hash_max_size 2048;

at nginx.conf.

perusio avatar Jan 28 '14 01:01 perusio