Page 1 of 1

[Error] nginx: [emerg] duplicate location "/" in /etc/nginx/conf/supercache.conf:15

PostPosted:21 Jun 2018 15:51
by vpssim82
Hi vpssim,

can you please help, i got this error :

nginx: [emerg] duplicate location "/" in /etc/nginx/conf/supercache.conf:15
nginx: configuration file /etc/nginx/nginx.conf test failed

Here is the screenshot :
http://prntscr.com/jxiesy

here is what inside superchache.conf
set $cache_uri $request_uri;

if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
location / {
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$args;
}
# SECURITY : Deny all attempts to access PHP Files in the uploads directory
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
# PLUGINS : Enable Rewrite Rules for Yoast SEO SiteMap
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

Re: [Error] nginx: [emerg] duplicate location "/" in /etc/nginx/conf/supercache.conf:15

PostPosted:21 Jun 2018 16:02
by nguyenoanh
Hello.
If you are using plugin wp super cache for your wordpress blog. Please using the default config Vhost for it. It is ready config for Wp Super Cache plugins without error.

You must re-edit your domain vhost /etc/nginx/conf.d/domain.com.conf like below, it will be ok.
Code: Select all
#///////////////////////////////////////////////////////
# You can use only 1 rule (AAA or BBB or CCC or DDD or EEE)
# Please do not delete line AAA, BBB, CCC , DDD or EEE. Only Comment it if you do not use. 
# All of them need for [ Config Vhost For Plugin Cache ] function in [ Wordpress Blog Tools ]
#///////////////////////////////////////////////////////


#Run all the websites (Wordpress, Xenforo, Joomla, Phpbb .... ),if you use your rule, comment the line below (AAA)
#include /etc/nginx/conf/all.conf;

# If you use your rule, comment the line above , and  Uncoment 3 lines belows and set your rule within it.. (BBB)
#location / {
#Uncomment 3 lines and set your rules here!
#}

# Rule for wordpress + Plugin wp super cache. (CCC)
include /etc/nginx/conf/supercache.conf;  

# Rule for wordpress + Plugin W3 Total Cache. (DDD)
#include /etc/nginx/conf/w3total.conf; 

# Rule for wordpress + Plugin WP-Rocket. (EEE)
#include /etc/nginx/conf/wprocket.conf; 
 

# Config Cache Static Files
include /etc/nginx/conf/staticfiles.conf;

Comment :
Code: Select all
#include /etc/nginx/conf/all.conf;
Uncomment:
Code: Select all
include /etc/nginx/conf/supercache.conf;  

Re: [Error] nginx: [emerg] duplicate location "/" in /etc/nginx/conf/supercache.conf:15

PostPosted:21 Jun 2018 16:09
by vpssim82
Thank you nguyenoanh

Re: [Error] nginx: [emerg] duplicate location "/" in /etc/nginx/conf/supercache.conf:15

PostPosted:21 Jun 2018 16:11
by nguyenoanh
vpssim82 wrote:
21 Jun 2018 16:09
Thank you nguyenoanh
You're wellcome :)