Skip to content

Instantly share code, notes, and snippets.

@trungpv1601
Created July 14, 2017 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trungpv1601/553bc03722bd87b709667cc5efcfa82a to your computer and use it in GitHub Desktop.
Save trungpv1601/553bc03722bd87b709667cc5efcfa82a to your computer and use it in GitHub Desktop.
Laravel in a Sub Directory with NGINX
location ^~ /xxx {
alias /var/www/xxx/public;
try_files $uri $uri/ @xxx;
location ~* \.php {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/xxx/public/index.php;
}
}
location @xxx {
rewrite ^/xxx/(.*)$ /xxx/index.php/$1 last; # THIS IS THE IMPORTANT LINE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment