I am trying to configure my nginx. I want it to serve a php file: dir/index.php
,but do it the way that i can acces it with localhost/dir
request (with no trailing slash) without invoking nginx 301 redirect
. I tried all of the solutions found here, however failed. Can you please explain how can i reach this goal? This is my config:
server {
access_log /var/log/nginx/access_log combined;
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/mock-api-server.git;
index index.php;
location ~* \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}