Struggling to adapt nginx to my framework and get the equivalent of, in apache config :
Alias /site1 "/home/framework/public_HTML"
(and then localhost/site1 displays site1 with local/dev settings thanks to $_SERVER['REQUEST_URI']
)
What I have now with nginx :
server {
listen localhost:80;
server_name localhost;
root /home/framework;
index /public_HTML/index.php;
location /site1 {
# alias /home/framework/public_HTML/;
# index index.php;
# try_files $uri $uri/ =404;
# try_files /home/framework/public_HTML/index.php =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
-> whether I comment in or out the lines in location /site1, all or none, adding removing trailing slash all around... => transparent redirect to localhost/site1/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/ (as copied from the url in the browser)
So, with everything commented out as it is shown, the correct index.php is getting the request & i'm getting a response but the url in the url bar and the $_SERVER['REQUEST_URI']
passed by nginx to my index.php file becomes
/site1/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/
Why this loop ?