Laravel (PHP Framwork) on ISPConfig and document root problem

Discussion in 'ISPConfig 3 Priority Support' started by DonMcCoy, Nov 10, 2016.

  1. DonMcCoy

    DonMcCoy New Member HowtoForge Supporter

    Hello Guys,

    I have a Laravel application on Nginx web server and as you know the public directory is set to: web/public, the following manuel settings works flawlessly for me:

    Code:
    root /var/www/mysite.com/web/public;
            try_files $uri $uri/ /index.php?$query_string;
    Now with ISPConfig as i can't change the directory root, I've tried everything else as directives but couldn't get it to work properly.

    I've tried this:

    Code:
    location / {
    try_files $uri $uri/ /index.php?$query_string;
    rewrite ^(.*)$ /public/$1 break;
    }

    this is will work to rewrite to public but any further link after public will produce loop error, for example: /web/public/register

    will produce loop with the following error:

    Code:
    rewrite or internal redirection cycle while processing "/public//public//public//public//public//public//public 
    what am i be missing in the rewrite line above to stop this loop and btw, why i have double slashes (public//) !!!!

    any idea will be highly appreciated,

    Thanks in Advance
     
  2. DonMcCoy

    DonMcCoy New Member HowtoForge Supporter

    UPDATE [Solved]:
    with the following Nginx Directive I was able to solve all problems and redirect all request to /public without changing the root directory.

    Code:
    location / {
      try_files /public/$uri /public/$uri/ /public/index.php?$query_string;
    }
     
    till likes this.

Share This Page