Hello, a Wordpress plugin (Cachify) for managing Memcached, is asking me to add some code to nginx.conf file to work.
It says:
nginx Memcached setup
Please add the following lines to your nginx.conf
## GZIP
gzip_static on;
## CHARSET
charset utf-8;
## INDEX LOCATION
location / {
error_page 404 405 = @nocache;
if ( $query_string ) {
return 405;
}
if ( $request_method = POST ) {
return 405;
}
if ( $request_uri ~ "/wp-" ) {
return 405;
}
if ( $http_cookie ~ (wp-postpass|wordpress_logged_in|comment_author)_ ) {
return 405;
}
default_type text/html;
add_header X-Powered-By Cachify;
set $memcached_key $host$uri;
memcached_pass localhost:11211;
}
## NOCACHE LOCATION
location @nocache {
try_files $uri $uri/ /index.php?$args;
}
I tried to add this code in My Domain / Apache & nginx Settings / Additional nginx directives and Im getting this error:
Invalid nginx configuration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/system/xxxxx.com/conf/vhost_nginx.conf:8 nginx: configuration file /etc/nginx/nginx.conf test failed
Any help to know why i cant add this code? And how to add it?
Thanks for any help.
It says:
nginx Memcached setup
Please add the following lines to your nginx.conf
## GZIP
gzip_static on;
## CHARSET
charset utf-8;
## INDEX LOCATION
location / {
error_page 404 405 = @nocache;
if ( $query_string ) {
return 405;
}
if ( $request_method = POST ) {
return 405;
}
if ( $request_uri ~ "/wp-" ) {
return 405;
}
if ( $http_cookie ~ (wp-postpass|wordpress_logged_in|comment_author)_ ) {
return 405;
}
default_type text/html;
add_header X-Powered-By Cachify;
set $memcached_key $host$uri;
memcached_pass localhost:11211;
}
## NOCACHE LOCATION
location @nocache {
try_files $uri $uri/ /index.php?$args;
}
I tried to add this code in My Domain / Apache & nginx Settings / Additional nginx directives and Im getting this error:
Invalid nginx configuration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/system/xxxxx.com/conf/vhost_nginx.conf:8 nginx: configuration file /etc/nginx/nginx.conf test failed
Any help to know why i cant add this code? And how to add it?
Thanks for any help.