Laravel route rewrite nginx conf 設定


server {
    listen       80;
    server_name  localhost;

    root   /usr/share/nginx/html/S1/public;
    index index.php index.html index.htm;

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

    location ~ \.php$ {

        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
( 複製貼上時 restart nginx 如果異常 ,記得靠最上面對齊不要留空隙 )