w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Nginx virtual host error duplicate location "/" in /etc/nginx/vhosts/

The problem is that you have the same location defined twice, just like the error says, you need to remove this block

location / {
            try_files
/wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/
/index.php?$args ;
}

and then delete this in the other file

try_files $uri @backend;

and put this instead

try_files
/wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri
@backend;

here's the @backend location

location @backend {
  proxy_pass http://127.0.0.1:8081;
}

Any other location should just use this same proxy location, and for the ~.php I think it can be replaced with something like this

location ~ .php$ {
  try_files @backend =404;
}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.