0

Just as an experiment, I was trying to remove my index.php from the webroot in nginx and directly point to app.php, as the only thing the index file does is this:

<?php

chdir(dirname(__DIR__));
include 'app.php';

My nginx setup is pretty easy:

server {
    listen      80;
    server_name localhost;
    root        /vagrant/public;

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

    # some includes here
}

And simply pointing out of the web root does not work:

server {
    listen      80;
    server_name localhost;
    root        /vagrant/public;

    location / {
        try_files $uri /../app.php?$query_string;
    }

    # some includes here
}

It is for me a bit hard to search for this case, as there are many problems popping up based on the used key words, but all related to another problem.

There is no real need for this, but with nginx such a powerful tool I can't imagine this is not possible. So, it it?

1 Answer 1

0

You probably only need to set the index paragraph in your nginx config. Try index app.php; and reload nginx.

1
  • How could that work? It is still outside the webroot. I have tried btw, but it didn't work. Probably because it is all relative to the web root. Commented Aug 6, 2015 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .