1

I am trying to add phpfilename with .php extension.
My partial NGINX configuration is:

server {
    set $MAGE_ROOT /home/user/public_html;
    root $MAGE_ROOT/pub;

    location / {
        root $MAGE_ROOT;
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location /pub/ {
        ...
        alias $MAGE_ROOT/pub/;
        add_header X-Frame-Options "SAMEORIGIN";
    }

    location ~ (index|get|static|report|404|503|phpfilename)\.php$ {
        fastcgi_intercept_errors off;
        try_files $uri =404;

        fastcgi_pass $PHPFMSOCK_LOC;
        fastcgi_buffers 1024 4k;

        fastcgi_read_timeout 600s;
        fastcgi_connect_timeout 600s;
        fastcgi_index  index.php;

        include        fastcgi_params;
        fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
        fastcgi_param  PHP_VALUE "memory_limit=768M \n max_execution_time=18000";
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }

    location ~* (\.php$|\.htaccess$|\.git) {
        deny all;
    }

}

Option 1 (FAIL):
Placing file in to the root /home/user/public_html/
Output: No input file specified.

Option 2 (FAIL):
Placing file in to the pub folder /home/user/public_html/pub/
Output: No input file specified.

Option 3 (SUCCESS):
Placing same duplicate file in to the root AND pub folders
/home/user/public_html/
/home/user/public_html/pub/
Output: page file contents.

Environment:
Magento 2.2.0
Nginx nginx/1.9.14
Cpanel with Centos 6
PHP 7.0.24
php.ini cgi.fix_pathinfo = 0

Iv been trying all insane dated and outdated ways all day since morning, and still unable to figure out the proper way. Any suggestions will be really appreciated. Thank you.

2
  • looking at your config do you understand where is your root ? Commented Oct 15, 2017 at 8:10
  • I suspect pub folder, option(2) is what I expect from this config. But, as I mentioned, it wont work, unless I copy same file in to the site root as well, and have it in both places. Commented Oct 15, 2017 at 14:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.