CentOS 6.4 install and configure LNMP server to build Wordpress

Source: Internet
Author: User
Tags install wordpress wordpress database

CentOS 6.4 install and configure LNMP server to build Wordpress

Preparation:
1. configure the firewall to enable port 80 and port 3306

# Firewall configuration written by system-config-firewall

# Manual customization of this file is not recommended.

* Filter

: Input accept [0: 0]

: Forward accept [0: 0]

: Output accept [0: 0]

-A input-m state-state ESTABLISHED, RELATED-j ACCEPT

-A input-p icmp-j ACCEPT

-A input-I lo-j ACCEPT

-A input-m state-state NEW-m tcp-p tcp-dport 22-j ACCEPT

-A input-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT

-A input-m state-state NEW-m tcp-p tcp-dport 3306-j ACCEPT

-A input-j REJECT-reject-with icmp-host-prohibited

-A forward-j REJECT-reject-with icmp-host-prohibited

COMMIT

~

2. Deployment

Install

1. Install nginx

Yum remove httpd * php * # Delete the built-in software package

Yum install nginx-y # install nginx

LNMP

Chkconfig nginx on # Set nginx startup

Service nginx start # start nginx

Ii. Install MySql

1. Install MySQL

Yum install mysql-server-y # yum install mysql until it is complete

LNMP

/Etc/init. d/mysqld start # start MySQL

LNMP

Chkconfig mysqld on # Set to boot

Cp/usr/share/mysql/my-medium.cnf/etc/my. cnf # copy the configuration file (Note: if there is a my. cnf Direct Overwrite under the/etc directory by default)

2. Set a password for the root account

Mysql_secure_installation

# Press enter. Enter Y as prompted. Enter the password twice. Press enter. Enter Y as prompted. Thabjs for using Mysql is displayed!

LNMP

LNMP

After setting the Mysql password, restart MySQL:

/Etc/init. d/mysqld restart # restart

/Etc/init. d/mysqld stop # stop

/Etc/init. d/mysqld start # start

3. Install PHP5

1. Install PHP5

Yum install php-fpm-y # install php until it is completed

LNMP

2. Install the PHP component. PHP5 supports MYSQL.

Yum install php-mysql php-gd libjpeg * php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

# Select the preceding installation package for installation. Enter Y and press enter as prompted.

LNMP

Chkconfig php-fpm on # Set the startup of php-fpm

/Etc/init. d/php-fpm start # start php-fpm

Configuration:

1. Configure nginx to support php

Cp/etc/nginx. conf/etc/nginx. confbak # back up the original configuration file

Vim/etc/nginx. conf # edit the configuration file

User nginx; # change the nginx running account to; nginx users in the nginx Group

: Wq # Save and exit

Cp/etc/nginx/conf. d/default. conf/etc/nginx/conf. d/default. confbak # back up the original configuration file

Vim/etc/nginx/conf. d/default. conf # edit the configuration file

Index. php index.html index.htm; # add index. php (about 14 rows ):

LNMP

# Pass the PHP scripts to FastCGI server listening on Fig: 9000

#

Location ~ \. Php $ {

Root html;

Fastcgi_pass 127.0.0.1: 9000;

Fastcgi_index index. php;

Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;

Include fastcgi_params;

}

LNMP

# Cancel the location comment of the FastCGI server and change the parameter of the fastcgi_param line to $ document_root $ fastcgi_script_name or use the absolute path.

Service nginx restart # restart nginx

This article from the Linux community website (www.linuxidc.com) original link: http://www.linuxidc.com/Linux/2014-08/105128p3.htm

Ii. PHP configuration

Vim/etc/php. ini # Edit

Date. timezone = PRC # Remove the semicolon from the front line around 878 and change it to date. timezone = PRC.

LNMP

Expose_php = off # disable the display of PHP version information around 375 lines

LNMP

Short_open_tag = ON # PHP short labels are supported in line 211

LNMP

: Wq # Save and exit

3. Configure php-fpm

Cp/etc/php-fpm.d/www. conf/etc/php-fpm.d/www. confbak # back up the original configuration file

Vim/etc/php-fpm.d/www. conf # Edit

User = nginx # change the user to nginx

Group = nginx # change the group to nginx

: Wq # Save and exit

LNMP

Test

Cd/usr/share/nginx/html

Vim index. php # Add the code

Phpinfo ();

?>

: Wq # Save and exit

Chown nginx. nginx/usr/share/nginx/html-R # Set permissions

Service nginx restart # restart nginx

Service php-fpm restart # restart php-fpm

LNMP

Enter the Server IP address in the browser of the client to view the configuration information.

Indicates that lnmp is successfully configured.

At this point, CentOS6.4 has completed the installation and configuration of LNMP (nginx + php + mysql,

1. Download wordpress website code

Http://cn.wordpress.org/download Chinese wordpress website source code on official website

Decompress the package

2. delete the files under/usr/share/nginx/html and copy the decompressed wordpress source code to this directory. (Note: Copy all the files in wordpress to the directory, the wordpress folder is not copied)

LNMP

3. Create a wordpress Database

Mysql-u root-p # log on to mysql as the root user and enter the password

LNMP

Mysql> create database zrq; # create a database named zrq

LNMP

Mysql> use zrq; # When you press the Enter key to see Database changed, the operation is successful !)

4. install wordpress

Open a browser on the client and enter the IP address of the server:

LNMP

Click Create configuration file:

LNMP

Click "Start now"

LNMP

Modify/usr/share/nginx/html permissions before submission

Chmod 777-R/usr/share/nginx/html

After modification, click submit:

LNMP

Click to install and enter the relevant website information:

LNMP

Click install wordpress. The following figure shows that the blog has been successfully created.

LNMP

LNMP

Logon Interface

Congratulations! Your website has been built successfully!

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.