I would like to execute a custom php file (required for a validation and scan) on our Magento2 installation. The file however should remain and be located in the main /var/www/html/ folder and not in the /var/www/html/pub/ folder.
I have tried the following in my main vhost configuration but still getting a 404
location /mycustomfile.php {
try_files $uri $uri/;
location ~* \.php$ {
fastcgi_pass fastcgi_backend;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Also I have seen to "whitelist" the file in /var/www/html/nginx.conf.sample under:
# PHP entry point for main application
location ~
(index|get|static|report|404|503|health_check|mycustomfile)\.php$ {
Some expert help would be greatly appreciated, thank you!
EDIT:
Okay I figured it out:
location /mycustomfile.php {
try_files $uri $uri/;
root /var/www/html;
location ~* \.php$ {
fastcgi_pass fastcgi_backend;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}