路线将我重定向到主页(laravel)

时间:2014-12-22 18:17:30

标签: apache nginx laravel-4 ubuntu-14.04

确定 现在我用uache和nginx代理在ubuntu 14.4上安装了laravel 4.2。

当我创建像

这样的路线时
Route::get('/reg', function()
{
    return 'hii';
});

apache view" hii"当我打电话给#34; localhost:8080 / reg"

但是当我打电话给#34; localhost / reg"时,nginx查看主页面在浏览器中

nginx配置:

server {
        listen   80;

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

        server_name localhost;

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

    if (!-d $request_filename) {
        rewrite     ^/(.+)/$ /$1 permanent;
    }

        location ~ \.php$ {

        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;

         }

 # PHP FPM configuration.
    location ~* \.php$ {
            fastcgi_pass                    unix:/var/run/php5-fpm.sock;
            fastcgi_index                   index.php;
            fastcgi_split_path_info         ^(.+\.php)(.*)$;
            include                         /etc/nginx/fastcgi_params;
            fastcgi_param                   SCRIPT_FILENAME $document_root$fastcgi_script$
    }

         location ~ /\.ht {
                deny all;
        }
}

哪里错了?

1 个答案:

答案 0 :(得分:0)

根据您的nginx.conf,它正在加载您的/var/www/laravel/public/index.php;。如果您不希望这种情况发生,

  • nginx.conf中的路径调整为您想要的文件load

OR

  • 创建一个视图,然后指向该视图的路径。