Skip to main content
Version: 3.0

WordPress Image Guide

warning
  • This document applies to images of version >=6.8. For images of version <=6.6, please refer to the 2.x documentation.

Introduction

By default, network access is turned off to a ECS instance. You can specify rules in a security group that allows access from an IP address range, port, or ECS security group.

You must specify port numbers (for TCP):

  • 22 (ssh)
  • 80 (http)
  • 443 (https)

Alibabacloud Security groups document URL: Alibabacloud Security group

Image environment description

  • Software versiondetails: wordpress-6.8.1-zh_CN
  • Source installation directory: /data/wwwroot/wordpress
  • WordPress is based on LEMPSTACK: LEMPSTACK Image Guide

WordPress Guide

WordPress Login Info

  • Browser access address: http://<Public IP of the server>
  • Username: admin
  • Password: Random password , Login to the server via SSH and execute cat ReadMe to view the password

Database Info

How to add a virtual host

Exec command
sudo /root/weiliu/vhost.sh
e.g.: Execute command process
[root@WeiLiu ~]# sudo /root/weiliu/vhost.sh

#######################################################################
# Setting up virtual hosts on HTTP Server #
#######################################################################

What Are You Doing?
1. Use HTTP Only
2. Use your own SSL Certificate and Key
3. Use Let's Encrypt to Create SSL Certificate and Key
q. Exit
Please input the correct option: 3

Please input domain(example: www.example.com): demo.linuxeye.com
domain=demo.linuxeye.com

Please input the directory for the domain:demo.linuxeye.com :
(Default directory: /data/wwwroot/demo.linuxeye.com): /data/wwwroot/wordpress
Virtual Host Directory=/data/wwwroot/wordpress

Create Virtul Host directory......
set permissions of Virtual Host directory......

Do you want to add more domain name? [y/n]: y

Type domainname or IP(example: example.com other.example.com): demo2.linuxeye.com
domain list=demo2.linuxeye.com

Do you want to redirect from demo2.linuxeye.com to demo.linuxeye.com? [y/n]: y

Do you want to redirect all HTTP requests to HTTPS? [y/n]: y

Please select domain cert key length.
Enter one of 2048, 3072, 4096, 8192 will issue a RSA cert.
Enter one of ec-256, ec-384, ec-521 will issue a ECC cert.

Please enter your cert key length (default 2048): 2048

Please enter your email: lj2007331@mail.com

[Sun Oct 30 04:27:06 PM CST 2022] Create account key ok.
[Sun Oct 30 04:27:06 PM CST 2022] No EAB credentials found for ZeroSSL, let's get one
[Sun Oct 30 04:27:13 PM CST 2022] Registering account: https://acme.zerossl.com/v2/DV90
[Sun Oct 30 04:27:15 PM CST 2022] Could not get nonce, let's try again.
[Sun Oct 30 04:27:39 PM CST 2022] Registered
[Sun Oct 30 04:27:39 PM CST 2022] ACCOUNT_THUMBPRINT='LMG4Elq-AFm-IH17QAk3yjmp-8TNoxi__gWTIIT1tzY'
....
[Sun Oct 30 04:28:20 PM CST 2022] Cert success.

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

Do you want to add hotlink protection? [y/n]: n

Allow Rewrite rule? [y/n]: y

Please input the rewrite of programme :
wordpress,opencart,magento2,drupal,joomla,codeigniter,laravel
thinkphp,pathinfo,discuz,typecho,ecshop,nextcloud,zblog,whmcs rewrite was exist.
(Default rewrite: other): wordpress
You choose rewrite=wordpress

Allow Nginx/Tengine/OpenResty access_log? [y/n]: y
You access log file=/data/wwwlogs/demo.linuxeye.com_nginx.log

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......

#######################################################################
# Setting up virtual hosts on HTTP Server #
#######################################################################
Your domain: demo.linuxeye.com
Virtualhost conf: /usr/local/nginx/conf/vhost/demo.linuxeye.com.conf
Directory of: /data/wwwroot/wordpress
Rewrite rule: /usr/local/nginx/conf/rewrite/wordpress.conf
Let's Encrypt SSL Certificate:/usr/local/nginx/conf/ssl/demo.linuxeye.com.crt
SSL Private Key: /usr/local/nginx/conf/ssl/demo.linuxeye.com.key

The above Directory of is the website root directory (/data/wwwroot/wordpress), which will be automatically created after the script is executed. Please upload the code to this directory when deploying the website (directory, subdirectory and file permissions are: www)

  • Nginx the configuration file path: /usr/local/nginx/conf/vhost/demo.linuxeye.com.conf
  • Nginx the rewrite file path: /usr/local/nginx/conf/rewrite/wordpress.conf

WP-CLI

WP-CLI is a command-line interface for managing WordPress. You can perform operations such as managing email addresses and passwords without using a browser.

Modify WordPress Email

The wp-cli command needs to be executed in the root directory of the wordpress website
cd /data/wwwroot/wordpress
View wordpress user information, such as uid = 1
wp --allow-root user list
Change uid = 1 corresponding to Email
wp --allow-root user update 1 --user_email=admin@linuxeye.com
tip

Change admin@linuxeye.com to your own email address

Modify WordPress password

The wp-cli command needs to be executed in the root directory of the wordpress website
cd /data/wwwroot/wordpress
View wordpress user information, such as uid = 1
wp --allow-root user list
Change uid = 1 corresponding to Password
wp --allow-root user update 1 --user_pass=linuxeye_com
tip

Change linuxeye_com to your own password

Modify WordPress website domain

The wp-cli command needs to be executed in the root directory of the wordpress website
cd /data/wwwroot/wordpress
The replacement command will not be actually executed at this time, because we added the --dry-run parameter, you can see whether the number of entries that need to be replaced matches the estimate
wp --allow-root search-replace 'http://47.238.47.1' 'https://new.example.com' --dry-run
Remove the --dry-run parameter and execute the replacement
wp --allow-root search-replace 'http://47.238.47.1' 'https://new.example.com'
tip
  • http://47.238.47.1 is your current access address, please note that it needs to be changed to your own server public network IP
  • Replace https://new.example.com with your own domain name, note that the protocol should be included.