Browse Source

基础配置

lizhen_gitee 10 months ago
parent
commit
5c2d030b24
4 changed files with 50 additions and 6 deletions
  1. 2 0
      .gitignore
  2. 4 4
      application/database.php
  3. 37 0
      public/admin.php
  4. 7 2
      public/nginx.htaccess

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+.idea
+runtime

+ 4 - 4
application/database.php

@@ -16,13 +16,13 @@ return [
     // 数据库类型
     'type'            => Env::get('database.type', 'mysql'),
     // 服务器地址
-    'hostname'        => Env::get('database.hostname', '127.0.0.1'),
+    'hostname'        => Env::get('database.hostname', '106.54.206.212'),
     // 数据库名
-    'database'        => Env::get('database.database', 'zhiyin_db'),
+    'database'        => Env::get('database.database', 'xiaoyouyuan'),
     // 用户名
-    'username'        => Env::get('database.username', 'zhiyin_db'),
+    'username'        => Env::get('database.username', 'xiaoyouyuan'),
     // 密码
-    'password'        => Env::get('database.password', 'skX47RDJEGhPXGiK'),
+    'password'        => Env::get('database.password', 'NyJpMzAGbFNk3CLM'),
     // 端口
     'hostport'        => Env::get('database.hostport', ''),
     // 连接dsn

+ 37 - 0
public/admin.php

@@ -0,0 +1,37 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+// [ 后台入口文件 ]
+// 使用此文件可以达到隐藏admin模块的效果
+// 为了你的安全,强烈不建议将此文件名修改成admin.php
+// 定义应用目录
+define('APP_PATH', __DIR__ . '/../application/');
+
+// 判断是否安装
+/*if (!is_file(APP_PATH . 'admin/command/Install/install.lock')) {
+    header("location:./install.php");
+    exit;
+}*/
+
+// 加载框架引导文件
+require __DIR__ . '/../thinkphp/base.php';
+
+// 绑定到admin模块
+\think\Route::bind('admin');
+
+// 关闭路由
+\think\App::route(false);
+
+// 设置根url
+\think\Url::root('');
+
+// 执行应用
+\think\App::run()->send();

+ 7 - 2
public/nginx.htaccess

@@ -1,3 +1,8 @@
-if (!-e $request_filename){
-    rewrite  ^(.*)$  /index.php?s=$1  last;   break;
+location ~* (runtime|application)/{
+	return 403;
 }
+location / {
+	if (!-e $request_filename){
+		rewrite  ^(.*)$  /index.php?s=$1  last;   break;
+	}
+}