• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

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