这是我第一次尝试将Laravel应用程序从本地环境迁移到远程服务器。
所以基本上我已将本地Laravel 5.4应用程序的全部内容上传到我的远程服务器的这个文件夹中:
/var/www/html/HotelRegistration
然后我尝试将此URL打开到浏览器(我的远程服务器):
http://89.36.211.48/HotelRegistration/public/
以及如何看到标准的Laravel主页出现(预计,我必须用自定义的页面替换此页面)。
问题是在我的 web.xml 文件中我声明了这些路线:
Route::get('/', function () {
return view('welcome');
});
Route::get('contact', function() {
return View::make('contact');
});
Route::post('contact', 'EnquiryController@index');
Route::resource('/registration', 'RegistrationController');
第一个是与标准Laravel页面相关的工作正常,最后一个是:
Route::resource('/registration', 'RegistrationController');
它应该通过 RegistrationController 类处理对 / registration 的HTTP GET请求,此控制器类包含此 index()方法:
/**
* Metodo che mostra la pagina di registrazione di un nuovo utente albergatore.
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index(){
Log::info('index() START');
return view('/registration/index');
}
打开此网址:
http://89.36.211.48/HotelRegistration/public/registration
应显示注册页面。但是,正如您可以看到打开它我得到 Not Found 错误消息。
进入 /var/www/html/HotelRegistration/storage/logs/laravel.log 文件没有任何内容,我希望在前一个方法控制器的开头放置日志的输出,所以它似乎没有进入这种方法。
奇怪的是,在我的localhost系统(http://localhost/HotelRegistration/public/registration)上打开相同的URL,它可以正常工作。
我在想,如果我在本地环境上执行此判断,可能是路由问题(可能缺少某些路线):
php artisan route:list
我获得:
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | activate | | App\Http\Controllers\RegistrationController@activate | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | contact | | Closure | web |
| | POST | contact | | App\Http\Controllers\EnquiryController@index | web |
| | GET|HEAD | errors | errors | Closure | web |
| | POST | registration | registration.store | App\Http\Controllers\RegistrationController@store | web |
| | GET|HEAD | registration | registration.index | App\Http\Controllers\RegistrationController@index | web |
| | GET|HEAD | registration/create | registration.create | App\Http\Controllers\RegistrationController@create | web |
| | DELETE | registration/{registration} | registration.destroy | App\Http\Controllers\RegistrationController@destroy | web |
| | PUT|PATCH | registration/{registration} | registration.update | App\Http\Controllers\RegistrationController@update | web |
| | GET|HEAD | registration/{registration} | registration.show | App\Http\Controllers\RegistrationController@show | web |
| | GET|HEAD | registration/{registration}/edit | registration.edit | App\Http\Controllers\RegistrationController@edit | web |
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
包含此路线:
| | GET|HEAD | registration | registration.index | App\Http\Controllers\RegistrationController@index | web |
应该是与我的控制器之前的 index()方法相关的路线。
但我发现它在我的远程环境上也执行相同的声明:
root@Betrivius-VPS:/var/www/html/HotelRegistration# php artisan route:list
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | activate | | App\Http\Controllers\RegistrationController@activate | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | contact | | Closure | web |
| | POST | contact | | App\Http\Controllers\EnquiryController@index | web |
| | GET|HEAD | errors | errors | Closure | web |
| | GET|HEAD | registration | registration.index | App\Http\Controllers\RegistrationController@index | web |
| | POST | registration | registration.store | App\Http\Controllers\RegistrationController@store | web |
| | GET|HEAD | registration/create | registration.create | App\Http\Controllers\RegistrationController@create | web |
| | GET|HEAD | registration/{registration} | registration.show | App\Http\Controllers\RegistrationController@show | web |
| | PUT|PATCH | registration/{registration} | registration.update | App\Http\Controllers\RegistrationController@update | web |
| | DELETE | registration/{registration} | registration.destroy | App\Http\Controllers\RegistrationController@destroy | web |
| | GET|HEAD | registration/{registration}/edit | registration.edit | App\Http\Controllers\RegistrationController@edit | web |
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
那么可能是什么问题?为什么在我的远程环境中,这个URL(http://89.36.211.48/HotelRegistration/public/registration)似乎不像在本地那样被处理?
可能是什么问题?我错过了什么?我该如何解决它?
答案 0 :(得分:0)
您需要先更改权限并提供required权限并运行此命令
作曲家安装 要么 作曲家更新
谢谢