diff --git a/serverless.component.yml b/serverless.component.yml index e80cdea..2c9980b 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: wordpress -version: 0.2.3 +version: 0.2.5 author: Tencent Cloud, Inc. org: Tencent Cloud, Inc. description: Deploy a serverless wordpress.js application on Tencent SCF and API Gateway. diff --git a/src/_shims/handler.php b/src/_shims/handler.php index fa7e59a..40ea294 100644 --- a/src/_shims/handler.php +++ b/src/_shims/handler.php @@ -52,6 +52,7 @@ function active_mysql_connect() "swf" => "video/mpeg4", "tif" => "image/tiff", "tiff" => "image/tiff", + "ttf" => "application/x-font-ttf", "vcf" => "text/x-vcard", "wav" => "audio/wav", "wma" => "audio/x-ms-wma", @@ -69,7 +70,6 @@ function active_mysql_connect() "torrent" => "application/x-bittorrent", ); - $request_uri = explode("?", $_SERVER['REQUEST_URI']); $local_file_path = $_SERVER['DOCUMENT_ROOT'] . urldecode($request_uri[0]); @@ -100,15 +100,27 @@ function active_mysql_connect() } fclose($fp); } elseif ( $extension == "php" && file_exists( $local_file_path ) ) { + header('Cache-Control:no-cache,must-revalidate'); + header('Pragma:no-cache'); + header("Expires:0"); + header("X-ExecFile: {$local_file_path}"); require( $local_file_path ); } elseif ( substr($local_file_path, -1) == "/" && file_exists( $local_file_path . "index.php" ) ) { + header('Cache-Control:no-cache,must-revalidate'); + header('Pragma:no-cache'); + header("Expires:0"); + $exec_file_path = $local_file_path . "index.php"; header("X-ExecFile: {$exec_file_path}"); require( $exec_file_path ); } else { + header('Cache-Control:no-cache,must-revalidate'); + header('Pragma:no-cache'); + header("Expires:0"); + $exec_file_path = dirname(__FILE__) . '/index.php'; header("X-ExecFile: {$exec_file_path}"); require( $exec_file_path ); diff --git a/src/config.js b/src/config.js index fd65cc1..18db1d3 100644 --- a/src/config.js +++ b/src/config.js @@ -70,8 +70,7 @@ const CONFIGS = { runtime: 'Nodejs12.16', handler: 'sl_handler.handler', cfsMountDir: '/mnt', - timeout: 120, - initTimeout: 3 + timeout: 120 }, // wp-server 函数配置 diff --git a/src/fixtures/layer/wp-layer.zip b/src/fixtures/layer/wp-layer.zip index b472285..8909abc 100644 Binary files a/src/fixtures/layer/wp-layer.zip and b/src/fixtures/layer/wp-layer.zip differ