4 years ago

NGINX: Routes ending in .php

Posted 4 years ago by ShaneTurner

This is likely an Nginx config issue, but so far I haven't found a solution.

I have a standard 404 page for non existent file requests, and this works file. Except for files ending .php, the server just returns a default "File not found." It's clearly not being processed by Laravel.


Anyone know the correct config to get this working?

Current config:

server {
    listen 443 ssl;
    root /home/development/code/sites/;

    index index.html index.htm index.php;

    charset utf-8;

    ssl_certificate /home/development/.ssl/nginx.crt;
    ssl_certificate_key /home/development/.ssl/nginx.key;

    rewrite ^/(.*)/$ /$1 permanent;

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log /home/development/code/log/ error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;

    location ~ /\.ht {
        deny all;

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