Laravel 5 - NGINX Server Config Issue with URL Query Strings

后端 未结 3 1800
粉色の甜心
粉色の甜心 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:02

    This is the sites-enabled NGINX server configuration that ended up working for me...

    server {
        listen 80;
        server_name registration.app;
        root /home/vagrant/Code/registration/public;
    
        charset utf-8;
    
        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  /var/log/nginx/registration.app-error.log error;
        error_page 404 /index.php;
        sendfile off;
    
        # Point index to the Laravel front controller.
        index index.php;
    
        location / {
            try_files $uri $uri/ index.php?$query_string;
        }
    
        location ~ \.php$ {
            try_files $uri /index.php =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    
        location ~ /\.ht {
            #deny all;
        }
    }
    

提交回复
热议问题