LAMP+Wolrdpress builds a personal blog in practice

        I always feel that writing this blog is a bit like being born a calf and not afraid of tigers. I have never dared to use such a title for fear of being stabbed by the big guys, but since I decided to do it, I will do it. Anyway, it is something I just learned. It's normal to be stabbed, the only idea is to come and see my stuff~

        Here we take Alibaba Cloud as an example. The configuration of ordinary one-core, 1M, and 2G memory is used. In fact, it is completely sufficient for practice and experiments. This configuration is not stuck in the network, and the command line is very fast, which is perfect. . (Let me tell you in advance, if it is Alibaba Cloud, remember to go to the security group policy to open ports 22 and 80)

        The tools we use here are not only a server with this configuration, but also a computer, and the software Xshell5 (you can download it from Baidu). Since I made a lot of mistakes when I learned it two days ago, I think I can make mistakes. It is very confident. It is also worth mentioning that the operations in this article are all logged in as root user. If you cannot use some commands, please add sudo9 at the beginning of the command.

        At the time of writing these two paragraphs our server seems to be ready, yes I re-initialized my server to write this stuff. let's start.

        First open Xshell5

        

        Enter the public IP of your server above, then enter the account password, log in, and run the following two commands after successful login:

        apt-get update (update software list)

        apt-get upgrade (upgrade software)

        Not surprisingly, your computer will run for a while, during which there should be a lot of characters jumping around, just let them jump around for a while, after the second input, there will be some options for you to choose, enter Y/n In this case, in general, just write Y, and then press Enter. The process of these two commands is about a few minutes, very fast. The LAMP environment is actually a combination of acronyms for Linux, apache, mysql-server, and phpmyadmin. Coincidentally, our installation order is also the same. You can choose to bring Linux when you buy a server. Of course, if you are your own computer You need to install one yourself, then update and upgrade your software, and then start installing the last three, now let's install apache

        apt-get install apache2

        When you enter Y/n, you can directly write Y and press Enter. After installation, we will install MySQL. The routine is the same, just replace apache2 with mysql-server:

         apt-get install mysql-server

        After that, you will be reminded to set a password for the account root. For the sake of convenience, we will always set it to 123456 when we encounter the same situation, but don't do this when you do it~ It is easy to be attacked. Next is phpmyadmin:

        apt-get install phpmyadmin

        There is a window for you to choose, [Space] to select apache, then tab space, the first step must be a space to prevent unnecessary trouble, and then there is a password for you to set, here we set the same as 123456 for simplicity

        service apache2 restart

        No accident, after you enter it, you can open the browser and enter your IP to see your website! Ubuntu is used here so the website looks like this:        

        Very good, so we are very close to success, let's go to the official website of word press for a walk, there is a download wordpress, after clicking, there is a download wordpress, right-click to copy the link.

        Start the installation below:

         cd / var / www / html

         weget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.zip (use shift+ins for the link here, if you follow what I just said)

        Your server will automatically download this compressed package~ I have to say that the speed of the server is still very fast, and then we install a decompression command, unzip:

        apt-get install unzip

        unzip wordpress-4.9.4-zh_CN.zip

        After a whirlwind of code, enter ls, you will find a wordpress folder in the current directory, then vim /etc/apche2/sites-available/000-default.conf, click i to enter the editing mode, find this below and enter it later /wordpress, let this configuration file path point to the wordpress folder just now, press esc

        shitf+:wq quit

        service apache2 restart

        No accident, if you visit your IP again, the wordpress interface will appear! But no accident, this error also appeared in your operation just now:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.39.137. Set the 'ServerName' directive globally to suppress this message

        At this time, we don't have to panic:   

        vim /etc/apache2/apache2.conf

        Also press i to enter edit mode, press Enter, and enter this line at the top:

        ServerName localhost

        Also press esc, shitf+:wq to exit.

        After that, enter /phpmyadmin after Ip, and create a database after the browser enters, and the name is wordpress.

        Just like before, we install rz, lrzsz

        apt-get install rz

        apt-get install lrzsz

         Create wp-config.php on your computer desktop and copy this paragraph into it:

<?php
/**
 * WordPress basic configuration file.
 *
 * This file is used by the installer to automatically generate the wp-config.php configuration file,
 * you can not use the website, you need to manually copy this file,
 * and rename it to "wp-config.php", then fill in the relevant information .
 *
 * This file contains the following configuration options:
 *
 * * MySQL Settings
 * * Keys
 * * Database Table Name Prefixes
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/en-us:%E7%BC% 96%E8%BE%91_wp-config.php
 *
 * @package WordPress
 */


// ** MySQL settings - specific information from the host you are using ** //
/** WordPress database name */
define('DB_NAME ', 'wordpress');


/** MySQL database username*/
define('DB_USER', 'root');


/** MySQL database password*/
define('DB_PASSWORD', '123456');


/** MySQL host */
define('DB_HOST', 'localhost');


/** Default character encoding when creating data tables*/
define('DB_CHARSET', 'utf8mb4');


/** Database collation type. Do not change if unsure */
define('DB_COLLATE', '');


/**#@+
 * Authentication key and salt.
 **
 Modified to any unique string!
 * Or go directly to {@link https://api.wordpress.org/secret-key/1.1/salt/
 * WordPress.org key generation service}
 * Any modification will invalidate all cookies and all users will have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY', 'W;b~}@Xh{6wLn=|V/!wXQ`<[YSqhl3/ga6>Uv)M&ek;D+Uc6%t1L^49WA&J@ iI:n');
define('SECURE_AUTH_KEY', '+=i87nTc$7=E48|[KYs*7~EDuK}}FiU#_ f($~ta ,HVb;Tiawaau9J%Q2:_rEuJ');
define(' LOGGED_IN_KEY', 'yzL[bH5bAGtCv!*&
wp_'; /**  * For developers: WordPress debug mode.  *





















 * Change this value to true and WordPress will display all prompts for development.
 * It is strongly recommended that plugin developers enable WP_DEBUG in the development environment.
 *
 * For additional information that can be used for debugging, visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', false);


/**
 * zh_CN localization settings: enable ICP record number display
 *
 * Can be modified in Settings → General.
 * To disable, remove or comment out this line.
 */
define('WP_ZH_CN_ICP_NUM', true);


/* Okay! Please do not continue editing. Please save this file. Happy to use! */


/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');


/** Set WordPress variables and include files. */

require_once(ABSPATH . 'wp-settings.php');

        Then enter the final cd /var/www/html/wordpress

        enter rz

        Select the file you just created and click OK.

        Go back to the web page, log in, click Install Now

        Go have fun!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324483186&siteId=291194637