August 2017
Intermediate to advanced
278 pages
8h 53m
English
As Laravel is PHP based, we'll be using PHP-FPM to compile the PHP code and present to NGINX. If this is new to you, it's worth reading through Chapter 2, Common PHP Scenarios which covers some of the other PHP scenarios and the PHP-FPM configuration.
To get going, we'll create a separate virtual configuration file for Laravel:
server {
listen 80;
server_name laravel.nginxcookbook.com;
access_log /var/log/nginx/laravel.access.log combined;
index index.php;
root /var/www/vhosts/laraveldemo/public;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; ...Read now
Unlock full access