首先是对应的版本
1 2 3 4 5 6 |
Laravel <span class="hljs-number">5.1</span> composer <span class="hljs-built_in">require</span> encore/laravel-admin <span class="hljs-string">"1.1.*"</span> Laravel <span class="hljs-number">5.2</span> composer <span class="hljs-built_in">require</span> encore/laravel-admin <span class="hljs-string">"1.2.*"</span> Laravel <span class="hljs-number">5.3</span> composer <span class="hljs-built_in">require</span> encore/laravel-admin <span class="hljs-string">"1.3.*"</span> Laravel <span class="hljs-number">5.4</span> composer <span class="hljs-built_in">require</span> encore/laravel-admin <span class="hljs-string">"1.4.x-dev"</span> Laravel <span class="hljs-number">5.5</span> composer <span class="hljs-built_in">require</span> encore/laravel-admin <span class="hljs-string">"1.5.x-dev"</span> |
我们选用Laravel 5.5
laravel 5.5
1 2 |
composer create-project --prefer-dist laravel/laravel=<span class="hljs-string">'5.5.*'</span> laravel-admin |
2.然后进去laravel-admin
文件中
1 2 |
<span class="hljs-built_in">cd</span> larabel-admin |
.env
的数据库连接设置,然后进去config/database
,修改mysql
的'strict' => true
,改为false
(mysql5.7
的需要改,5.7
以下的不需要改)
1 2 |
php artisan vendor:publish --provider=<span class="hljs-string">"Encore\Admin\AdminServiceProvider"</span> |
1 2 |
<span class="hljs-selector-tag">php</span> <span class="hljs-selector-tag">artisan</span> <span class="hljs-selector-tag">admin</span><span class="hljs-selector-pseudo">:install</span> |
laravel
的nginx
重写规则,在nginx
配置下加入try_files $uri $uri/ /index.php?$query_string;
1 2 3 4 5 6 7 |
location / { root <span class="hljs-string">'/www/laravel-admin/public'</span>; <span class="hljs-comment"># 网站默认首页</span> index index.php index.html index.htm; try_files <span class="hljs-variable">$uri</span> <span class="hljs-variable">$uri</span>/ /index.php?<span class="hljs-variable">$query_string</span>; } |
7.打开浏览器输入http://localhost/admin/
,使用用户名admin
和密码admin
登录
作者:Feng_Yikai
链接:https://www.jianshu.com/p/1110a2cad516
来源:简书