这是我第一次尝试将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类处理对/register的 HTTP GET 请求,这个控制器类包含以下index()方法:
/**
* Metodo che mostra la pagina di registrazione di un nuovo utente albergatore.
* @return IlluminateContractsViewFactory|IlluminateViewView
*/
public function index(){
Log::info('index() START');
return view('/registration/index');
}
打开此网址:
http://89.36.211.48/HotelRegistration/public/registration
应显示注册页面。但是,正如您所看到的,打开它时,我收到一条"未找到"错误消息。
进入/var/www/html/HotelRegistration/storage/logs/laravel.log文件什么都没有,我期望在前面的方法控制器的开头放出日志的输出,所以看起来它不会不输入此方法。
奇怪的是,在我的本地主机系统(http://localhost/HotelRegistration/public/registration)上打开相同的URL,它工作正常。
我在想,如果我在本地环境中执行此语句,这可能是路由问题(也许缺少某些路由):
php artisan route:list
我获得:
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | activate | | AppHttpControllersRegistrationController@activate | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | contact | | Closure | web |
| | POST | contact | | AppHttpControllersEnquiryController@index | web |
| | GET|HEAD | errors | errors | Closure | web |
| | POST | registration | registration.store | AppHttpControllersRegistrationController@store | web |
| | GET|HEAD | registration | registration.index | AppHttpControllersRegistrationController@index | web |
| | GET|HEAD | registration/create | registration.create | AppHttpControllersRegistrationController@create | web |
| | DELETE | registration/{registration} | registration.destroy | AppHttpControllersRegistrationController@destroy | web |
| | PUT|PATCH | registration/{registration} | registration.update | AppHttpControllersRegistrationController@update | web |
| | GET|HEAD | registration/{registration} | registration.show | AppHttpControllersRegistrationController@show | web |
| | GET|HEAD | registration/{registration}/edit | registration.edit | AppHttpControllersRegistrationController@edit | web |
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
包含以下路由:
| | GET|HEAD | registration | registration.index | AppHttpControllersRegistrationController@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 | | AppHttpControllersRegistrationController@activate | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | contact | | Closure | web |
| | POST | contact | | AppHttpControllersEnquiryController@index | web |
| | GET|HEAD | errors | errors | Closure | web |
| | GET|HEAD | registration | registration.index | AppHttpControllersRegistrationController@index | web |
| | POST | registration | registration.store | AppHttpControllersRegistrationController@store | web |
| | GET|HEAD | registration/create | registration.create | AppHttpControllersRegistrationController@create | web |
| | GET|HEAD | registration/{registration} | registration.show | AppHttpControllersRegistrationController@show | web |
| | PUT|PATCH | registration/{registration} | registration.update | AppHttpControllersRegistrationController@update | web |
| | DELETE | registration/{registration} | registration.destroy | AppHttpControllersRegistrationController@destroy | web |
| | GET|HEAD | registration/{registration}/edit | registration.edit | AppHttpControllersRegistrationController@edit | web |
+--------+-----------+----------------------------------+----------------------+------------------------------------------------------+--------------+
那么问题可能出在哪里呢?为什么在我的远程环境中,此 URL (http://89.36.211.48/HotelRegistration/public/registration) 似乎不像在本地环境中那样被压缩?
可能是什么问题?我错过了什么?我该如何尝试修复它?
您需要先更改权限并授予 require 权限并运行此命令
作曲家安装 或 作曲家更新
谢谢