简体   繁体   English

难以部署流明应用

[英]Difficulty deploying lumen app

I'm trying to deploy a small application to my remote server, however, I seem to be having difficulty with some of the routes. 我正在尝试将一个小型应用程序部署到我的远程服务器上,但是,某些路由似乎有些困难。 Bare in mind that everything works on my local machine. 切记一切都可以在我的本地计算机上运行。

Here is what I've done: 这是我所做的:

  1. Uploaded the entire project to /home/user/app 将整个项目上传到/home/user/app
  2. Moved contents of /home/user/app/public to /home/user/public_html/api /home/user/app/public内容移动到/home/user/public_html/api
  3. Modified /home/user/public_html/api/index.php from: 从以下位置修改了/home/user/public_html/api/index.php

$app->run();

to

$request = Illuminate\Http\Request::capture();
$app->run($request);

...this allowed my first route to work, but I cannot load any other routes such as: ...这使我的第一条路线可以工作,但是我无法加载其他任何路线,例如:

http://www.mywebsite.com/api/v1/book

Please note that only http://www.mywebsite.com/api is the only route that loads correctly. 请注意,只有http://www.mywebsite.com/api是正确加载的唯一路由。

My routes.php looks like this: 我的routes.php看起来像这样:

$app->get('/', function() use ($app) {
    return "Lumen RESTful API";
});

$app->group(['prefix' => 'api/v1','namespace' => 'App\Http\Controllers'], function($app)
{
    $app->get('book','BookController@index');

    $app->get('book/{id}','BookController@getbook');

    $app->post('book','BookController@createBook');

    $app->put('book/{id}','BookController@updateBook');

    $app->delete('book/{id}','BookController@deleteBook');
});

My .htaccess is as follows: 我的.htaccess如下:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

The error I am receiving: 我收到的错误:

我收到的错误

Let me know if you need any more information? 让我知道您是否需要更多信息?

Any help would be greatly appreciated! 任何帮助将不胜感激!

将路由组前缀更改为:

$app->group(['prefix' => 'v1'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM