nginx+apache 下 重写问题

nginx的配置 88端口为apahce服务器
server {
    listen       80;
    server_name  laravel.t2.com;
    root /home/wwwroot/laravel.t2.com/current/;
    index index.php index.html index.htm;


    location ~ \.php$ {
            proxy_pass http:// 加粗文字laravel.t2.com:88;
            include naproxy.conf;
    }

    location / {
            # try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
            expires      30d;
    }

    location ~ .*\.(js|css)?$ {
            expires      12h;
    }
    access_log /www/web_logs/laravel.t2.com/access_nginx.log;
    error_log /www/web_logs/laravel.t2.com/error_nginx.log;

}

注释掉try_files后 访问 http:// laravel.t2.com/index.php/admin 会出现404错误

查看错误日志:
2016/05/27 16:30:02 [error] 7676#0: *1 open() "/home/wwwroot/laravel.t2.com/current/index.php/admin" failed (20: Not a directory), client: 10.1.5.91, server: laravel.t2.com, request: "GET /index.php/admin HTTP/1.1", host: "laravel.t2.com"
2016/05/27 16:36:19 [error] 7676#0: *2 open() "/home/wwwroot/laravel.t2.com/current/index.php/admin" failed (20: Not a directory), client: 10.1.5.91, server: laravel.t2.com, request: "GET /index.php/admin HTTP/1.1", host: "laravel.t2.com"

错误分析是去访问的index.php/admin 目录 所以会报错 不知道原因是什么
已邀请:

墨小颜

赞同来自:

[root@localhost php.laravel]# php artisan route:list
+--------+----------+-------+------+-------------------------------------------------------+------------+
| Domain | Method   | URI   | Name | Action                                                | Middleware |
+--------+----------+-------+------+-------------------------------------------------------+------------+
|        | GET|HEAD | /     |      | Closure                                               |            |
|        | GET|HEAD | admin |      | Bali\Http\Controllers\Admin\AdminHomeController@index |            |
+--------+----------+-------+------+-------------------------------------------------------+------------+

墨小颜

赞同来自:

求大神

墨小颜

赞同来自:

在本机测试nginx+php 可以正常访问
server {
    listen       80;
    server_name  laravel.t1.com;
    root E:/myGit/laravel.t2.com/public/;
    index index.php index.html index.htm;


    location ~ \.php$ {
        root           E:/myGit/laravel.t2.com/public/;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
            expires      30d;
    }

    location ~ .*\.(js|css)?$ {
            expires      12h;
    }
}

墨小颜

赞同来自:

Route::group(
['prefix' => 'admin', 'namespace' => 'Admin'],
function () {
    Route::get('/', 'AdminHomeController@index');
}
);

yal6820

赞同来自:

111

要回复问题请先登录注册