Module | Description |
SCF | It implements the access layer of Serverless WordPress to run WordPress |
API Gateway | It is the ingress of WordPress and implements RESTful APIs |
CFS | It is the serverless storage warehouse for WordPress |
TDSQL-C Serverless | You can create a TDSQL-C for MySQL serverless database to implement a pay-as-you-go and automatically scalable database service |
VPC | It is used to connect SCF, CFS, and TDSQL-C Serverless over the private network to ensure network isolation |
ap-guangzhou-4
, ap-shanghai-2
, ap-beijing-3
, and ap-nanjing-1
.wordpress-demo
folder locally and download the application from the WordPress official website into it.serverless.yml
configuration file and complete application configuration as follows (for more information on the configuration, please see the configuration document):app: wordpressstage: devcomponent: wordpressname: wordpressDemoinputs:region: ap-shanghai # Project regionzone: ap-shanghai-2src: # Project path, which should be your WordPress pathsrc: ./wordpressexclude:- .envapigw: # API Gateway configurationcustomDomains: # (Optional) Bind a custom domain name- domain: abc.com # The custom domain name to be boundcertId: abcdefg # Unique certificate ID of the custom domain name to be boundcustomMap: true # Whether the path is custompathMap:- path: /environment: releaseprotocols: # Type of the protocol of the custom domain name to be bound, which is the same as that of the frontend service protocol- http- https
.wordpress-demo├── wordpress # WordPress source file├── serverless.yml # Configuration file└── .env # Environment variable file
sls deploy
to complete the deployment. Below is an example:$ sls deployserverless ⚡frameworkAction: "deploy" - Stage: "dev" - App: "appDemo" - Instance: "wordpressDemo"region: ap-shanghaizone: ap-shanghai-2vpc:...cfs:...db:...apigw:created: trueurl: https://service-xxxxx.sh.apigw.tencentcs.com/release/...layer:...wpInitFaas:...wpServerFaas:...
apigw
part, configure the account and password as prompted, and you can start using your WordPress application.SCF_QcsRole
must have the CFSFullAccess permissionCODING_QCSRole
must have the QcloudSLSFullAccess, QcloudSSLFullAccess, and QcloudAccessForCODINGRole permissions{"message":"There is no api match env_mapping '\\/'"}
was reported. What should I do?php.ini
to change the limit on the size of uploaded files?php.ini
file in the etc
folder to the etc/php.d
folder. You can also directly use the package provided by Tencent Cloud.
When packaging and uploading the layer again, pay attention to the hierarchy in the package and compress only files in the parent directory; otherwise, function initialization will fail:
wp-server-xxx
function as follows:#!/bin/bashexport PATH="/opt/bin:$PATH"export LD_LIBRARY_PATH=/opt/lib/:$LD_LIBRARY_PATHexport PHP_INI_SCAN_DIR=/opt/etc/php.dphp -d extension_dir=/opt/lib/php/modules/ sl_handler.php 1>&2
Was this page helpful?