Unable to run Magento 2 Web Setup on nginx
-
15-04-2021 - |
Question
I've downloaded Magento 2 and try to setup but getting blank page.
When I have checked nginx
log file and I found below the log.
FastCGI sent in stderr: "Access to the script '/var/www/html/magento2/demo/setup/index.php/navigation' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 127.0.0.1, server: 224.example.com, request: "GET /setup/index.php/navigation HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "224.example.com", referrer: "http://224.example.com/setup/"; 2018/05/23 16:58:47 [error] 18961#18961: 319 FastCGI sent in stderr: "Access to the script '/var/www/html/magento2/demo/setup/index.php/navigation/side-menu' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 127.0.0.1, server: 224.example.com, request: "GET /setup/index.php/navigation/side-menu HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "224.example.com", referrer: "http://224.example.com/setup/"; 2018/05/23 16:58:47 [error] 18959#18959: *377 FastCGI sent in stderr: "Access to the script '/var/www/html/magento2/demo/setup/index.php/navigation/header-bar' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 127.0.0.1, server: 224.example.com, request: "GET /setup/index.php/navigation/header-bar HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "224.example.com", referrer: "http://224.example.com/setup/";
If anyone faces the same issue then help me.
Solution
Solved:
Changed nginx.conf.sample setup location block to:
Default Magento nginx.conf.sample file need to replace.
location ~* ^/setup($|/) {
root $MAGE_ROOT;
location ~ ^/setup/index.php {
fastcgi_pass fastcgi_backend;
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=600";
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/setup/(?!pub/). {
deny all;
}
location ~ ^/setup/pub/ {
add_header X-Frame-Options "SAMEORIGIN";
}
}
Replace with:
location /setup {
root $MAGE_ROOT;
location ~ ^/setup/index.php {
### This fixes the problem:
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
################################
fastcgi_pass fastcgi_backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/setup/(?!pub/). {
deny all;
}
location ~ ^/setup/pub/ {
add_header X-Frame-Options "SAMEORIGIN";
}
}
Found solution from git
OTHER TIPS
No need to Replace whole code in nginx.conf.sample
just replace location ~* ^/setup($|/)
to location ^/setup($|/)
.
Because issue is ~*
sign before setup Url, browser doesn't understand this