Laravel routes not found after nginx install Laravel routes not found after nginx install nginx nginx

Laravel routes not found after nginx install


This is the correct basic config for Laravel and Nginx:

server {    listen   80 default_server;    root /var/www/laravel/public/;    index index.php index.html index.htm;    location / {         try_files $uri $uri/ /index.php$is_args$args;    }    # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock    location ~ \.php$ {            try_files $uri /index.php =404;            fastcgi_pass unix:/var/run/php5-fpm.sock;            fastcgi_index index.php;            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;            include fastcgi_params;    }}

EDIT:Instead of:

fastcgi_pass unix:/var/run/php5-fpm.sock;

As of November 2018, as PHP 7.2 is out, it would be:

fastcgi_pass unix:/var/run/php7.2-fpm.sock;


When I sent parameters by get I did not recognize them, I just have to activate the following:try_files $uri $uri/ /index.php$is_args$args;

location / {    try_files $uri $uri/ /index.php$is_args$args;}


I had same problem after updating few lines nginx working fine..

It's for windows ( change root acording your file system )

1.root html/laravel; #Update Here - add project folder name after html

2.try_files $uri $uri/ /index.php$is_args$args; #Update Here - Add this for 404 not found error

server {    listen 80; # IPv4    server_name localhost;    ## Parametrization using hostname of access and log filenames.    access_log logs/localhost_access.log;    error_log logs/localhost_error.log;    ## Root and index files.    root html/laravel; #Update Here - add project folder name after html    index  index.php index.html index.htm;    ## If no favicon exists return a 204 (no content error).    location = /favicon.ico {        try_files $uri =204;        log_not_found off;        access_log off;    }    ## Don't log robots.txt requests.    location = /robots.txt {        allow all;        log_not_found off;        access_log off;    }    ## Try the requested URI as files before handling it to PHP.    location / {try_files $uri $uri/ /index.php$is_args$args; #Update Here - Add this for 404 not found error        ## Regular PHP processing.        location ~ \.php$ {            try_files  $uri =404;            fastcgi_pass   php_processes;            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;            include        fastcgi_params;        }        ## Static files        location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {            expires max;            log_not_found off;            ## No need to bleed constant updates. Send the all shebang in one            ## fell swoop.            tcp_nodelay off;            ## Set the OS file cache.            open_file_cache max=1000 inactive=120s;            open_file_cache_valid 45s;            open_file_cache_min_uses 2;            open_file_cache_errors off;        }        ## Keep a tab on the 'big' static files.        location ~* ^.+\.(?:ogg|pdf|pptx?)$ {            expires 30d;            ## No need to bleed constant updates. Send the all shebang in one            ## fell swoop.            tcp_nodelay off;        }        } # / location}