Tencent Cloud Host installation LNMP environment and WordPress tutorial _linux

Source: Internet
Author: User
Tags fpm install php mysql host php mysql ssh create database install wordpress yum repolist

Many cloud hosts have student concessions, so I took advantage of the current freshman bought a 1 yuan Cloud host + free CN domain Name (high school students will not think of the words). Since I only know to use the server to install the blog, other uses do not understand, so I went to install WordPress.

And because I see the tutorial a bit of a problem, some problems search engine can not solve, I either blindly toss the whole good, or reload the system, the last one quite smooth, half an hour or so installed, but the follow-up there are a variety of problems, a solution. So it is easy to write down a person who has a blog. I refer to the tutorial Aliyun CENTOS7 installation LNMP environment and WordPress (a bit of a pit but still nice).

    1. lnmp=linux+nginx+mysql+php
    2. The installation process to select y/n y
    3. Forget what you lost in the last step you can use the ↑↓ of the keyboard to view
    4. The # Behind the sentence indicates the comment

1. Install Nginx

#yum install Nginx #配置文件处于/etc/nginx
#systemctl start nginx #启动nginx
#systemctl enable Nginx.service # set to boot

Test: 123.206.57.252 Open the public network IP can see the Nginx page.

2. Install MySQL

#rpm-UVH http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
#yum repolist enabled | grep Mysql.-community. "
#yum-y install mysql-community-server #安装社区版, fast 3 minutes, slow or 40 minutes

#systemctl start mysqld # boot MySQL
#mysql_secure_ Installation # MySQL security installation, the root password initially empty, set up their own

#mysql-uroot-p
mysql>create database WordPress; #创建wordpress数据库
mysql>use WordPress;
Mysql>quit #或者exit

3. Install PHP

3.1 Installation PHP-FPM

#yum Install php-fpm php-mysql
#systemctl start php-fpm # startup php-fpm
#systemctl enable PHP-FPM # setting boot

#mk Dir/usr/www
#chown-R apache:apache/usr/www

3.2 Login Host in WINSCP

WINSCP Menu-Options-Editor-default encoding, select UTF-8.
Set SSH: Advanced-ssh-Authentication-key file.
The password is the cloud host's password, modifies the password to be shut down first.

3.3 Modifying Nginx configuration files

Open the nginx.conf under/etc/nginx, where the server section is modified as follows:

server {    listen       Default_server    
 listen       [::]:80 default_server;
    server_name  ffflipped.cn;
    root        /usr/www;
       # Load configuration files for the default server block.
    include/etc/nginx/default.d/*.conf;
       location/{        index index.php;
        try_files $uri $uri//index.php $args;
   &NBSP}        rewrite/wp-admin$ $scheme://$host $uri/permanent;        location ~* ^.+\. (ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar| MID|MIDI|WAV|BMP|RTF) $ {                access_log off; Log_not_found off;
Expires Max;    &NBSP}        location ~ \.php$ {     
   try_files $uri = 404;
        fastcgi_split_path_info ^ (. +\.php) (/.+) $;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;         fastcgi_param script_filename $document _root$fastcgi_script_name
;
        include Fastcgi_params;    &NBSP}   }

Overload Nginx after saving

#systemctl Reload Nginx

Creating index.php in the/usr/www directory

Test: 123.206.57.252 or parse the good domain http://ffflipped.cn can see Hello world!

4 Install WordPress

4.1 Build the site

Download and extract a good WordPress installation package, with WINSCP will/wordpress under the folder and file all uploaded to the/usr/www/directory.
Modify wp-config-sample.php MySQL database information, inside the MySQL host to fill in the localhost, rather than the public network IP and so on.

After saving visit 123.206.57.252 fill in the site information, close to success!

4.2 Permission settings

However, you will find that the blog can not upload pictures, the background can not install Plug-ins and themes, this time is the issue of permissions.
wp-config.php file finally adds the following sentence:

Define (' Fs_method ', "direct");

and execute the order.

#chmod 777/usr/www-r #这里的-R is a recursive subdirectory, file
#systemctl reload Nginx

Although 777 (the maximum read and write permissions) is not safe, but I will only this small white solution.

Summarize

Braved the mid-term exam did not review the risk of Hanging Branch, Pooh, I Can not Hang branch, to toss the server blog, how can I do this? No matter. In short, a good sense of achievement, cool.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.