路由不适用于Nginx服务器

时间:2016-03-04 12:09:36

标签: php laravel ubuntu nginx

我在Windows 8操作系统中使用XAMPP服务器在Laravel 5.1`中创建了一个项目。

现在我想使用Ubuntu 14和Nginx服务器实现这个项目。我已经执行了以下链接中提到的所有配置。

https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04

不幸的是,当我检查控制台时,我无法运行项目"不推荐使用getPreventDefault()"问题。请改用defaultPrevented。"似乎路由问题。下面是我的route.php代码片段:

<?php

/****************   Model binding into route **************************/

Route::model('user', 'App\User');
Route::pattern('id', '[0-9]+');
Route::pattern('slug', '[0-9a-z-_]+');

/***************    Site routes  **********************************/
Route::get('/', 'HomeController@index');
//Route::get('/', function(){ return 'This is testing';});
Route::get('home', 'HomeController@index');
Route::get('about', 'PagesController@about');
Route::get('contact', 'PagesController@contact');
//Route::get('contact', 'ContactController@getContactUsForm');

Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
 ]);

下面是我的Nginx.conf文件

server {
listen 80 default_server;
listen [::]:80 default_server ;

root /var/www/carwalepro/public;
index index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name localhost;

location / {
        try_files $uri $uri/ /index.php?$query_string;
        }

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#

  location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        }
}

在Nginx上运行laravel项目需要哪些配置?

0 个答案:

没有答案