Skip to content

Instantly share code, notes, and snippets.

@koenhendriks
Last active June 3, 2022 20:20
Show Gist options
  • Save koenhendriks/795140351a4eaab9af75df2c04efedda to your computer and use it in GitHub Desktop.
Save koenhendriks/795140351a4eaab9af75df2c04efedda to your computer and use it in GitHub Desktop.
Laravel Docroot IspConfig 3.1 Nginx
location / {
root {DOCROOT}public
if ($scheme != "https") {
rewrite ^ https://$http_host$request_uri? permanent;
}
try_files /public/$uri /public/$uri/ /public/index.php?$query_string;
}
@Tha14
Copy link

Tha14 commented May 27, 2022

Like 2 should be terminated by a semicolon.

EDIT: You should use this directive in ispconfig for laravel since it fixes all problems I encountered:

##subroot public ##

location / {
    try_files $uri $uri/ /index.php?q=$uri&$args;
}

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    {FASTCGIPASS}
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $request_filename;
 }

@koenhendriks
Copy link
Author

I haven't used ISP Config in > 5 years but thanks for the feedback, I hope it's helpful for other that land here from Google.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment