• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/

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