-1

Being building a virtualhost for wordpress, I would like to know if this set seems correct or not at all.

location / {

    try_files $uri $uri/ =404;
}

location / {
        try_files $uri $uri/ /index.php?$args;
}

The second line comes from Nginx's website, in an example concerning Wordpress so not knowing if I should keep the first one or not; as much as I ask before doing stupid things. Can it be possible to directly merge the two parts into one ?

Barbosa
  • 19
  • 5

1 Answers1

0

You defenetly need only one rule to match "/" because the second rule will never be matched, so your rule should look like this:
location / { try_files $uri $uri/ /index.php?$args; }
You can find more about nginx locations here: Understanding Nginx Server and Location Block Selection Algorithms

G. Siganos
  • 747
  • 1
  • 12
  • 21
  • For the rules I suspected a little but at least you confirmed me that but what I wanted to know is what was the best to use for Wordpress. – Barbosa May 30 '18 at 15:46