Nginx Laravel 4.1第一条路线添加,给出错误。
我刚刚使用推荐的安装选项安装了Laravel4.1Nginx Laravel 4.1第一条路线添加,给出错误。,nginx,laravel,laravel-4,Nginx,Laravel,Laravel 4,我刚刚使用推荐的安装选项安装了Laravel4.1 composer create-project laravel/laravel your-project-name --prefer-dist 一切顺利,因为我能够在/public/中看到默认页面,然后我删除了.htaccess文件,因为我使用的是nginx,并添加了try\u files$uri$uri//index.php?$query\u字符串在位置~\.php${…}中为nginx创建了一个简单的路由 Route::get('/abo
composer create-project laravel/laravel your-project-name --prefer-dist
一切顺利,因为我能够在/public/
中看到默认页面,然后我删除了.htaccess
文件,因为我使用的是nginx,并添加了try\u files$uri$uri//index.php?$query\u字符串
在位置~\.php${…}
中为nginx创建了一个简单的路由
Route::get('/about', function()
{
return "about page";
});
但是我从nginx获得了常见的
404未找到nginx/1.0.15
。我已经对整个laravel文件夹授予了777权限。有什么问题吗 您需要将nginx指向公用文件夹。以下是我在nginx中的一个站点配置文件:
server {
listen 80 default;
server_name _;
root /var/www/laravel/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
这样,您可以通过请求:http://localhost/
注意:也许你的php cgi是不同的:使用你已有的fastcgi\u pass
规则。
读取.htaccess
文件不会造成任何伤害
希望这对您有用。听起来更像是nginx问题,而不是laravel问题。您是否能够显示默认主页?谢谢。我创建了两个
location/{…}
,我想它们是冲突的。请随意查看我关于将127.0.0.1:8080
更改为localhost
:)的新问题