I have a webserver, with two PHP applications. One (WordPress) is living in the root, and another is living in a /forums location directive. In the /forums location I have to explicitly call php files for it to load. It does not automatically respect the index rule, set in the vhost.

What am I doing wrong?

root /www/wordpress;
index index.php;

location / {
  try_files $uri $uri/ /index.php?$args ;
  add_header Access-Control-Allow-Origin *;
location /forums {
  alias /www/forums;

1 Answer 1


The index directive operates on URIs that end with /. See this document for more.

You explicitly add a trailing / with your $uri/ clause in the try_files statement in the location / block. Which is missing from your location /forums block.

You should use root instead of alias where the final path segments are the same. See this document for details.


location /forums {
    root /www;
    try_files $uri $uri/ =404;

See this document for try_files syntax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.