Answer the question
In order to leave comments, you need to log in
I just can’t run Laravel 5 in php7-fpm, nginx on Debian 8, who understands this?
I want to run laravel in sub directory
My host config
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Redirect server error pages to the static page #
location / {
try_files $uri $uri/ /index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# Pass the PHP scripts to FastCGI server #
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
# phpmyadmin
location /phpmyadmin {
alias /usr/share/phpmyadmin;
}
location ~ ^/phpmyadmin(.+\.php)$ {
alias /usr/share/phpmyadmin;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$1;
include fastcgi_params;
}
location ~ ^/phpmyadmin/(.*\.(eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|xls|tar|bmp))$ {
alias /usr/share/phpmyadmin/$1;
expires 30d;
log_not_found off;
access_log off;
}
# Laravel
location ^~ /laravel {
alias /usr/share/nginx/html/laravel/public;
try_files $uri $uri/ @laravel;
location ~ \.php {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
}
error_log /var/log/nginx/seriesadmin-error.log error;
location @laravel {
rewrite /laravel/(.*)$ /laravel/index.php?/$1 last;
}
}
File not found.
2016/08/08 19:08:28 [error] 1268#1268: *3 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 109.163.234.7, server: localhost, request: "GET /laravel/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "81.171.2.119"
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
from the config, displays a pure white page. Answer the question
In order to leave comments, you need to log in
location ^~ /laravel {
alias /usr/share/nginx/html/laravel/public;
try_files $uri $uri/ @laravel;
location ~ \.php {
root /usr/share/nginx/html/laravel/public;
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location @laravel {
rewrite /laravel/(.*)$ /laravel/index.php?/$1 last;
}
"File not found." writes php-fpm if it cannot find the file with the script.
try setting @laravel location to "root"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question