diff --git a/application/admin/command/Install.php b/application/admin/command/Install.php
index 82dd8c7..f7cd11a 100644
--- a/application/admin/command/Install.php
+++ b/application/admin/command/Install.php
@@ -199,19 +199,23 @@ class Install extends Command
         // 后台入口文件
         $adminFile = ROOT_PATH . 'public' . DS . 'admin.php';
 
-        // 生成数据库Env配置文件
-        $envFile = ROOT_PATH . '.env.sample';
-        $envStr = @file_get_contents($envFile);
+        // 数据库配置文件
+        $dbConfigFile = APP_PATH . 'database.php';
+        $config = @file_get_contents($dbConfigFile);
         $callback = function ($matches) use ($mysqlHostname, $mysqlHostport, $mysqlUsername, $mysqlPassword, $mysqlDatabase, $mysqlPrefix) {
             $field = "mysql" . ucfirst($matches[1]);
             $replace = $$field;
-            return "{$matches[1]} = {$replace}" . PHP_EOL;
+            if ($matches[1] == 'hostport' && $mysqlHostport == 3306) {
+                $replace = '';
+            }
+            return "'{$matches[1]}'{$matches[2]}=>{$matches[3]}Env::get('database.{$matches[1]}', '{$replace}'),";
         };
-        $envConf = preg_replace_callback('/(hostname|database|username|password|hostport|prefix)\s*=\s*(.*?)\n/', $callback, $envStr);
+        $config = preg_replace_callback("/'(hostname|database|username|password|hostport|prefix)'(\s+)=>(\s+)Env::get\((.*)\)\,/", $callback, $config);
 
-        $result = @file_put_contents(ROOT_PATH . '.env', $envConf);
+        // 检测能否成功写入数据库配置
+        $result = @file_put_contents($dbConfigFile, $config);
         if (!$result) {
-            throw new Exception(__('The current permissions are insufficient to write the file %s', '.env'));
+            throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/database.php'));
         }
 
         // 变更默认管理员密码
@@ -275,15 +279,17 @@ class Install extends Command
             'public' . DS . 'assets' . DS . 'libs'
         ];
 
+        //数据库配置文件
+        $dbConfigFile = APP_PATH . 'database.php';
+
         if (version_compare(PHP_VERSION, '7.0.0', '<')) {
             throw new Exception(__("The current version %s is too low, please use PHP 7.0 or higher", PHP_VERSION));
         }
         if (!extension_loaded("PDO")) {
             throw new Exception(__("PDO is not currently installed and cannot be installed"));
         }
-        $envConfFile = ROOT_PATH . '.env';
-        if (is_file($envConfFile) && !is_really_writable($envConfFile)) {
-            throw new Exception(__('The current permissions are insufficient to write the file %s', '.env'));
+        if (!is_really_writable($dbConfigFile)) {
+            throw new Exception(__('The current permissions are insufficient to write the configuration file application/database.php'));
         }
         foreach ($checkDirs as $k => $v) {
             if (!is_dir(ROOT_PATH . $v)) {
diff --git a/application/common.php b/application/common.php
index 351db24..3e6bbe5 100755
--- a/application/common.php
+++ b/application/common.php
@@ -370,7 +370,7 @@ if (!function_exists('check_cors_request')) {
         if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN']) {
             $info = parse_url($_SERVER['HTTP_ORIGIN']);
             $domainArr = explode(',', config('fastadmin.cors_request_domain'));
-            $domainArr[] = request()->host();
+            $domainArr[] = request()->host(true);
             if (in_array("*", $domainArr) || in_array($_SERVER['HTTP_ORIGIN'], $domainArr) || (isset($info['host']) && in_array($info['host'], $domainArr))) {
                 header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN']);
             } else {
diff --git a/application/config.php b/application/config.php
index 651de97..f109777 100755
--- a/application/config.php
+++ b/application/config.php
@@ -290,7 +290,7 @@ return [
         //允许跨域的域名,多个以,分隔
         'cors_request_domain'   => 'localhost,127.0.0.1',
         //版本号
-        'version'               => '1.2.0.20201001_beta',
+        'version'               => '1.2.0.20201008_beta',
         //API接口地址
         'api_url'               => 'https://api.fastadmin.net',
     ],