thetoad01
2 months ago
620
1
Servers

NGINX No input file specified

Posted 2 months ago by thetoad01

I am working on a legacy project where I cannot change the paths that use the .php extension. When developing locally and using php artisian serve I can use routes such as:

Route::get('/zipcode/get-zipcode-info.php', 'Zipcodes\[email protected]');

Then the request in my browser: http://127.0.0.1:8000/zipcode/get-zipcode-info.php?zipCode=06111

This works! I was very excited.

Then I deployed the code to our test server and get: "No input file specified."

The test server is running Nginx on Ubuntu 18.04

We have not been able to figure out how to set the config for the virtual host on Nginx to be able to ignore the .php extension and pass it along as a string to the route.

        listen 80;

        root /var/www/html/appdev/public;
        index index.php index.html index.htm;

        server_name appdev.newtechautomotiveservices.com;

        location ~ \.php$ {
                fastcgi_pass unix:/run/php/php7.3-fpm.sock;
                include fastcgi_params;
                fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param   SCRIPT_NAME     $fastcgi_script_name;
        }

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }
}

Please sign in or create an account to participate in this conversation.