I am installing Magento 2 into a subdirectory beside the main installation. I would like to configure the subdirectory named "test". However, when I try to access localhost/test to enter the setup page, it just tells:
localhost redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS.
Here is my NGINX config :
server {
listen 80 reuseport;
server_name localhost;
access_log /var/log/nginx/access.log ;
error_log /var/log/nginx/error.log ;
set $MAGE_ROOT /var/www/magento2;
root $MAGE_ROOT/pub;
## Magento Setup Tool
include conf_m2/setup.conf;
# Deny all internal locations also default phpmyadmin
location ~ ^/(app|bin|var|tmp|phpserver|vendor|magento_version|php[mM]y[aA]dmin|pma)/? { deny all; }
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
## Static location
include conf_m2/assets.conf;
location @static { rewrite /static/(version\d*/)?(.*)$ /static.php?resource=$2 last; }
location @media { try_files $uri $uri/ /get.php$is_args$args; }
## Process php files (strict rule, define files to be executed)
location ~ (index|health_check|get|static|report|404|503)\.php$ {
try_files $uri =404;
include conf_m2/php_backend.conf;
fastcgi_cache microcache;
fastcgi_cache_key $scheme|$host|search|$arg_q;
fastcgi_cache_valid 200 301 302 2h;
fastcgi_cache_use_stale updating error timeout invalid_header http_500;
fastcgi_pass_header Set-Cookie;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
}
###Here is the directory I want to installed another magento 2, but it now works
rewrite ^/test /test/$1 permanent;
location /test {
try_files $uri /$uri/index.php?$args;
index index.php index.html index.htm;
}
rewrite ^/test/admin /test/admin/$1 permanent;
}