Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 路由将我重定向到主页(laravel)_Apache_Nginx_Laravel 4_Ubuntu 14.04 - Fatal编程技术网

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

Apache 路由将我重定向到主页(laravel),apache,nginx,laravel-4,ubuntu-14.04,Apache,Nginx,Laravel 4,Ubuntu 14.04,嗯 现在我用apache和nginx代理在Ubuntu14.4上安装了Laravel4.2 当我创建类似于 Route::get('/reg', function() { return 'hii'; }); 调用“localhost:8080/reg”时的apache视图“hii” 但当我在浏览器中调用“localhost/reg”时,nginx会查看主页 nginx配置: server { listen 80; root /var/www/lar

嗯 现在我用apache和nginx代理在Ubuntu14.4上安装了Laravel4.2

当我创建类似于

Route::get('/reg', function()
{
    return 'hii';
});
调用“localhost:8080/reg”时的apache视图“hii”

但当我在浏览器中调用“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;
        }
}

哪里错了?

根据您的
nginx.conf
,它正在加载您的
/var/www/laravel/public/index.php。如果你不想发生这种事

  • nginx.conf
    中的路径调整为要
    加载的文件

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