Nginx别名与laravel4

 Max_coffee 发布于 2023-01-31 16:14

laravel的我的nginx配置

 server {
        listen          80;
        server_name     app.dev;
        rewrite_log     on;
        root            /var/www/l4/angular;
        index         index.html;

        location /{
        # URLs to attempt, including pretty ones.
            try_files   $uri $uri/ /index.php?$query_string;

        }
        location /lara/ {
          index index.php;
          alias /var/www/l4/public/;
        }
        # Remove trailing slash to please routing system.
        if (!-d $request_filename) {
            rewrite     ^/(.+)/$ /$1 permanent;
        }
        location ~ ^/lara/(.*\.php)$ {
              alias /var/www/l4/public/$1;
                      fastcgi_pass unix:/var/run/php5-fpm.sock;
                      fastcgi_index index.php;
                      fastcgi_param SCRIPT_FILENAME    $document_root$fastcgi_script_name;
                      include fastcgi_params;
        }
    }

Laravel路线:

Route::get('/', function()
{
    return View::make('index');
});

Route::get('x', function()
{
    return "alpha";
});

我的问题是," http://app.dev/lara/index.php "正在运行,但" http://app.dev/lara "和lara/x无效.

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有