LARAVEL application with NGINX server showing 404 error in windows

249 views Asked by At

I am new to PHP and Laravel.I have cloned a laravel project from git and save my local directory "C:\Projects\TestProject\public".

NGINX folder C:\nginx
php folder C:\PHP

My NGINX Config is as below

server {
   listen       80;
   server_name  localhost;
   root     C:/Projects/TestProject/public;

location / {
   
     try_files $uri $uri/ /index.php?$query_string;
     index index.html index.htm  index.php;
}
location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9999;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

I have also installed composer and necessary dependecies.But when i try to access http://localhost/TestProject/public/index.phpits showing 404 and showing No input file specified.

I have created a sample php file Test.php with phpinfo() int the same folder root.When i acces http://localhost/TestProject/public/Test.php it is displaying the PHP information on browser but the network shows 404 for the url. My PHP version is 7.4.

1

There are 1 answers

0
FelipeBHZ On

You have to include the params' file in the configuration block:

include fastcgi.conf;

Then the final block should be:

location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9999;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
    include        fastcgi.conf;
}