Laravel-admin重定向到登录页面
laravel-admin 是一个可以快速帮你构建后台管理的工具,它提供的页面组件和表单元素等功能,能帮助你使用很少的代码就实现功能完善的后台管理功能。
了解更多详情,可以前往官网地址 (opens new window)
# 1. Nginx伪静态配置
如果你将应用程序部署到运行 Nginx 的服务器上,你可以将以下配置文件作为为你的 Web 服务器配置的起点。
Nginx配置,更多信息可 查看文档 (opens new window)。
server {
listen 80;
listen [::]:80;
server_name example.com;
root /srv/example.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
关键配置。
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
1
2
3
2
3
# 2. 修改Laravel-admin配置文件
编辑 config/admin.php
文件,找到 auth 数组索引,增加如下配置。
'auth' => [
'excepts'=>[
'auth/login'
],
],
1
2
3
4
5
2
3
4
5
上次更新: 2023/09/05, 16:08:13