Installation of Laravel applications in ispmanager
Laravel applications can run in ispmanager 6 with PHP Composer installed and PHP running in FastCGI mode (Nginx + PHP-FPM).
Since PHP Composer uses the site's root directory for its operation, the Laravel application will need to be placed in a subdirectory, while the site's configuration will have to be manually modified.
In the server block, add the following line first to the location / section:
try_files $uri $uri/ /index.php?$query_string;In this same block, add the following sections:
location /<project_directory> {
alias /var/www/<user>/data/www/<site_name>/<project_directory>/public;
try_files $uri $uri/ @<project_directory>;
location ~ \.php$ {
//Values from the existing location @php
}
}
location @<project_directory> {
rewrite /<project_directory>/(.*)$ /<project_directory>/index.php?/$1 last;
}For example, if you host PyroCMS in the pyrocms subdirectory on the domain.com website, which is owned by the www-root user, the new sections will be the following:
location /pyrocms {
alias /var/www/www-root/data/www/domain.com/pyrocms/public;
try_files $uri $uri/ @pyrocms;
location ~ \.php$ {
include /etc/nginx/vhosts-resources/domain.com/dynamic/*.conf;
fastcgi_index index.php;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@laravel.test";
fastcgi_pass unix:/var/www/php-fpm/1.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
include fastcgi_params;
}
}
location @pyrocms {
rewrite /pyrocms/(.*)$ /pyrocms/index.php?/$1 last;
}