Chvalov
@Chvalov

Никак не могу запустить Laravel 5 в связке php7-fpm, nginx на Debian 8, кто в этом понимает?

Хочу запустить laravel в суб директории
Мой конфиг хоста
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;
		}
	}


При переходе на xx.xx.xx.xx/laravel получаю 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;
из конфига, выводит чисто белую страницу.

Как я понимаю проблема кроется в php, но не могу понять где (
  • Вопрос задан
  • 2147 просмотров
Решения вопроса 1
Chvalov
@Chvalov Автор вопроса
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;
                }
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
BuriK666
@BuriK666 Куратор тега Nginx
Компьютерный псих
"File not found." пишет php-fpm если не может найти файл со скриптом.

попробуйте в location @laravel указать "root"
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы