我正在学习Laravel使用它的教程。我使用LaraDock安装了Laravel和所需的堆栈。
当我转到运行应用程序的IP时,Nginx返回找不到的文件。以下是我的NGINX配置。
server {
root /var/www/laravel/public/;
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
这是NGINX错误日志中的错误。
2016/08/19 08:53:06 [错误] 47#47:* 16在stderr发送的FastCGI:“主脚本未知”,同时从上游读取响应头,客户端:192.168.99.1,server :, request:“GET / HTTP / 1.1“,上游:”fastcgi://111.13.0.5:9000“,主机:”192.168.99.100“
确保你在/var/www/laravel/public/
中有index.php
运行命令docker-compose exec nginx ls /var/www/laravel/public/
如果文件夹中没有index.php,则可能是项目文件夹安装错误。
你编辑.env或docker-compose.yml文件了吗?
将laradock文件夹放在相对于项目文件夹的位置