Unable to access PHP files outside the root of the nginx site document

I have a PHP application built on CodeIgniter. I have most of the website (the system folder for anyone who knows CodeIgniter) sitting under the root of the document.

Here is the nginx conf for the website

server {
server_name www.domain.local;
root /var/www/html/domain/frontend;
include /etc/nginx/conf.d/ci_vhost;
}

Here is the folder where I am having problems accessing /var/www/html/ci/2.0.2/system

With Apache, I never had problems accessing php files below the document root.

Does anyone know why I am having this problem with Nginx?

Thank.

+5
source share
1 answer

nginx , "", "" , .

server {

    # Default root
    root /var/www/html/domain/frontend;

    location /abc
        # Uses default root
        ...
    }

    location /xyz
        # defines it own root
        root /var/www/some/folder;
        ...
    }

    location /123
        # aliases to another folder
        alias /etc/some/folder;
        ...
    }

    location /
        # Uses default root
        ...
    }   

}

alias root

php open_basedir.

+5

All Articles