How to create a WordPress website

  Others-其他
  • Check upgrade in Ububtu

root@XSHQS01:~# apt-get update

root@XSHQS01:~# apt-get dist-upgrade

  • Installed Apache和MariaDB

root@XSHQSECS02:~# apt-get install apache2 mariadb-server mariadb-client

  • Start Apache and MariadDB also enable it in start up

root@XSHQSECS02:~# systemctl start apache2

root@XSHQSECS02:~# systemctl enable apache2

root@XSHQSECS02:~# systemctl start mariadb

root@XSHQSECS02:~# systemctl enable mariadb

  • Config MariaDB

root@XSHQSECS02:~# mysql_secure_installation

  • Install PHP and other depends packages

root@XSHQECSS01:~# apt-get install php php-mysql php-cgi php-cli php-gd phpmyadmin

  • Download and decompress wordpress using wget, you can copy the download link in WordPress website https://cn.wordpress.org/download/
  • root@XSHQSECS01:/var/www/html# cd /var/www/html

root@XSHQECSS01:~# wget https://cn.wordpress.org/latest-zh_CN.tar.gz

root@XSHQSECS02:/var/www/html#tar -xzvf latest-zh_CN.tar.gz --strip-components=0

root@XSHQSECS02:/var/www/html# rm -f index.html

  • Copy to the right directory
  • Restart apache and change the permission of the wordpress website directory

root@XSHQECSS01:/var/www/html# systemctl restart apache2

root@XSHQECSS01:/var/www/html# chown -R www-data:www-data /var/www/html/wordpress

root@XSHQSECS01:/var/www/html# chmod 755 /var/www/html/wordpress/

  • Change apache configuration file to the right directory of the website

root@XWKSweb01:/var/www/html# vim /etc/apache2/sites-available/000-default.conf

  • Config database and Wordperss website

root@XSHQSECS02:/var/www/html# mysql -u root -p

MariaDB [(none)]> create database wordpress;

MariaDB [(none)]> create user "user"@"%" identified by "123@ABCabc";

MariaDB [(none)]> grant all privileges on wordpress.* to "user"@"%";

MariaDB [(none)]> flush privileges;

MariaDB [(none)]> exit

Done

Enasble SSL for Apached Web server,must register the public domain name from domain provider, like Aliyun.

  • Install Certbot Client which is the tool to get certificates from Let’s Encrypt.

root@XWKSweb01:~# apt -y install certbot

  • Get certificates.Furthermore, it needs that it’s possible to access from the Internet to your working server on port 80 because of verification from Let’s Encrypt.

root@XWKSweb01:~# certbot certonly –webroot -w /var/www/html -d www.xwk.com

Config apache configuration file /etc/apache2/sites-available/default-ssl.conf

SSL valid

LEAVE A COMMENT