Last update at :2024-03-05,Edit by888u
A very important function of VPS is that you can build your own personal website. Based on open source WordPress, there is basically no basic knowledge required and it only takes a few minutes to complete the entire website building process. This article is a WordPress website building tutorial that teaches you how to build a personal website based on WordPress from scratch.
VPS and Domain Name
To build a website, you first need to have a VPS with an external IP and a domain name that can represent you. VPS is the place where your website data is stored. It is a host. The domain name is another name for your VPS address. For example, baidu.com is a domain name.
- Recommended VPS for website building: If you don’t have a VPS yet and don’t want to register, you can buy a bricklayer: "Tutorial on purchasing a bricklayer, supports Alipay, and has a recurring discount code of 6.81%". If you want to build a website, it is recommended to use CN2 GIA , for an introduction to CN2 GIA, you can refer to: "163 Backbone Network / CN2 GT / CN2 GIA Route Concept Introduction". For more website VPS recommendations, you can refer to: "Useful Mainland China/Foreign Website VPS Host Recommendations and Merchant Compilation". If you need a host in mainland China, you can consider Alibaba Cloud and Tencent Cloud (it is more recommended to use Tencent Cloud lightweight application host, with larger bandwidth and 100% CPU performance: "Latest Tencent Cloud Promotions, Tencent Cloud Vouchers Collection and Sharing") , Mainland China hosting website needs to complete the registration first.
- Recommended domain name for website building: If you don’t have a domain name, you can go to NameSilo to buy a domain name. It’s cheap & no price increase on renewal & free privacy protection: "NameSilo registration and domain name purchase tutorial, new user discount of US$1, supports Alipay payment", If you want to buy a domain name in mainland China, you can buy it directly from Alibaba Cloud or Tencent Cloud.
After you have a VPS host and domain name, you can refer to this tutorial to resolve your domain name to the IP of your VPS: "Domain Name Resolution Tutorial: Cloudflare Resolution and DNSPod Resolution".
LNMP environment setup
LNMP is the abbreviation of Linux+Nginx+MySQL+PHP. It refers to installing Nginx, MySQL and PHP on your VPS. Nginx can be used as a web host, MySQL is a database, and PHP can be used as a web development language. This is your It is the basis for building a website, so you can first build an LNMP environment and then build a website based on LNMP.
Linux can directly use LNMP scripts for environment construction and management: "One-click installation of LNMP environment on Linux, supporting CentOS/Ubuntu/Debian"
If you like the visual interface, you can also use the Pagoda panel: "Pagoda Linux Panel Installation Tutorial: Supports CentOS, Ubuntu, Debian"
Steps to build a WodrPress website
If you have completed the above two steps, you can officially start building a website in 5 minutes.
1.LNMP add website
After setting up the LNMP environment, just add a site directly through the LNMP script. For detailed tutorials, refer to: LNMP one-click adding website: configure domain name + create new MySQL + configure https certificate.
2. Download the latest WordPress package
Go directly to the WordPress official website to download the latest package:
wget http://wordpress.org/latest.tar.gzAfter downloading, unzip the file:
tar -xzvf latest.tar.gzAfter that, there will be an additional wordpress folder under the current folder, which contains all the content of WordPress.
3. Configure WordPress
By default, there is a wp-config-sample.php file in the wordpress folder. This is a sample file of the WordPress configuration file. First, rename it to wp-config.php (/root/wordpress refers to your The path under the wordpress folder can be viewed with the pwd command):
mv /root/wordpress/wp-config-sample.php /root/wordpress/wp-config.phpModify the configuration file content afterwards:
vi /root/wordpress/wp-config.phpWhat needs to be modified include DB_NAME, DB_USER, DB_PASSWORD and Unique Keys. The first three represent the database name, database user name and database user password respectively, which are set when you add a site (reference: LNMP one-click adding website: Configure domain name + create new MySQL + configure https certificate), Unique Keys can be generated directly at https://api.wordpress.org/secret-key/1.1/salt/, as shown below after modification:
After modifying the WordPress configuration, copy the WordPress content to your site directory. The default path is /home/wwwroot/your domain name. This path is also set when you add the website:
cp -r /root/wordpress/* /home/wwwroot/your domain nameAfter copying, give Nginx permission to operate this folder:
chown -R www:www /home/wwwroot/your domain nameAfter everything is done, open your domain name and you will see the WordPress installation page:
Select the language. After successful installation, enter your domain name and you will see that your personal website has been built:
Recommended site search: registered cn domain name, cloud server vps, foreign php host, European server, American virtual host, Ministry of Industry and Information Technology registration system, American virtual space, how to apply for a free domain name, free virtual host application, Western Digital registration, p>
发表评论