【发布时间】:2020-01-26 11:40:31
【问题描述】:
我在 vps 服务器上实现 laravel,只有一个 ip 地址,没有域。
它的工作并显示索引文件,但路由不工作并显示 404 未找到页面。
这是我的 web.php 文件:
<?php
Route::get('/', function () {
return view('welcome');
});
Route::get('/test' , function(){
return 'this is test route';
});
并在 .env 文件中设置 ip:
APP_URL=http://178.63.245.92
这是我的 vps 的 IP 地址:http://178.63.245.92/
当我说:http://178.63.245.92/test 它说:
Not Found
The requested URL /test was not found on this server.
必须做什么。
谢谢。
【问题讨论】:
-
您使用 Apache 作为 Web 服务器吗?
-
尝试清除缓存:
php artisan cache:clear -
是的,它是 centos 7 上的 apache
-
你的虚拟主机设置对了吗?
-
@script47 我运行 php artisan cache:clear 但它没有解决问题
标签: php laravel .htaccess dns routing