My environment is as follows:
- Linux version 4.4.0-105-generic (buildd@lgw01-amd64-060) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)) #128-Ubuntu SMP Thu Dec 14 12:42: 11 UTC 2017
- Nginx version: nginx/1.14.1
- PHP 7.2.13 (cli) (built: Dec 7 2018 16:36:58) ( NTS )
- Laravel 5.6
For historical reasons, I had to use a.php as the route for my project.
When I try to access a.php after the configuration is complete, the page displays: No input file specified.
And when I access the route of a non-php file, it will display laravel's 404 page, it is correct, because this route I did not set
So I think the problem is that the route is on the php file. When the route is forwarded, it seems to have some problems that I don't know. Unfortunately, I can't solve it.
My nginx configuration is as follows:
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
root /var/www/html/public;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name _;
# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
sendfile off;
# Add stdout logging
error_log /dev/null;
access_log /dev/null;
#static rewrite or try_files
#core route redirect
location / {
try_files $uri $uri/ /index.php?$query_string;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html/public;
internal;
}
# pass the PHP scripts to FastCGI server listening on socket
location ~ \.php$ {
#include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
#fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param HTTP_PROXY "";
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|webp|tiff|ttf|svg)$ {
expires 2d;
}
}
I tried modifying the value of cgi.fix_pathinfo in php.ini to 1
Then the error becomes: file not found
Does not seem to have an effect
In addition, my local environment is normal, but I use valet locally, it integrates nginx and made some changes, I can't compare the difference between its configuration and online environment.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2EpUjbm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire