Laravel 5 - NGINX Server Config Issue with URL Query Strings

后端 未结 3 1802
粉色の甜心
粉色の甜心 2021-02-06 18:35

Laravel is not receiving any $_GET variables from the URL query string. The $_GET and Input::all() are empty.

Example:

example.app/ex/

3条回答
  •  遥遥无期
    2021-02-06 19:12

    This appears correct, aside from being commented out.

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

    The bare bones one I use in testing is:

    server {
        listen 80 default_server;
    
        root /var/www/project/public;
        index index.php
        server_name localhost;
        location / {
                try_files $uri $uri/ /index.php?$args;
        }
    
        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                include fastcgi_params;
        }
    }
    

    $query_string and $args are functionally identical according to: NGINX Docs

提交回复
热议问题