• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

Error when changing Nginx configuration

Elicsan

New Pleskian
Hi there,

I have following problem when I try to cange the configuration file for Nginx in Plesk.

Details:
- Using Wordpress
- vServer
- PHP is handled through Nginx
- Memcached is enabled


To use the caching plugin "Cachify" in combination with memcached, the nginx configuration file must be edited.
Following config should be used:

Code:
## GZIP
gzip_static on;
## CHARSET
charset utf-8;
## INDEX LOCATION
location / {
	error_page 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;
}

When I try to save the new config, following error appears:

Invalid nginx configuration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/systemmydomain/conf/vhost_nginx.conf:8 nginx: configuration file /etc/nginx/nginx.conf test failed


How can I use the necessary configuration? I used google before, but some people said, that the server templated needs to be edited?



Thanks in advance!
 
Back
Top