CentOS 6.4 Installation Configuration Lnmp Server (nginx+php+mysql) and build WordPress

Source: Internet
Author: User
Tags fpm install php install wordpress wordpress database

Get ready:
1. Configure the firewall to turn on 80 ports, 3306 ports

# Firewall configuration written by System-config-firewall

# Manual Customization of this file are 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

~

II. deployment

Installation

I. Installing Nginx

Yum Remove httpd* php* #删除系统自带的软件包

Yum Install nginx-y #安装nginx

Lnmp

Chkconfig nginx on #设置nginx boot

Service Nginx Start #启动nginx

Two. Install MySQL

1. Install MySQL

Yum installs MySQL mysql-server-y #yum install MySQL until complete

Lnmp

/etc/init.d/mysqld Start #启动MySQL

Lnmp

Chkconfig mysqld on #设为开机启动

CP/USR/SHARE/MYSQL/MY-MEDIUM.CNF/ETC/MY.CNF #拷贝配置文件 (Note: If the/etc directory has a my.cnf directly covered by default)

2. Set a password for the root account

Mysql_secure_installation

#回车, enter Y as prompted, enter the password 2 times, enter Y as prompted, and finally appear thabjs for using mysql!

Lnmp

Lnmp

MySQL password setup is complete, restart MySQL:

/etc/init.d/mysqld Restart #重启

/etc/init.d/mysqld Stop #停止

/etc/init.d/mysqld Start #启动

Three. Installing PHP5

1. Installing PHP5

Yum Install PHP php-fpm-y #安装php直至完成

Lnmp

2. Install PHP components, is PHP5 support 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-b Cmath Php-mhash Libmcrypt

#这里选择以上安装包进行安装, enter Y return as prompted

Lnmp

Chkconfig php-fpm on #设置php-fpm boot up

/ETC/INIT.D/PHP-FPM Start #启动php-fpm

Configuration article:

I. Configuring NGINX support PHP

Cp/etc/nginx/nginx.conf/etc/nginx/nginx.confbak #备份原有的配置文件

Vim/etc/nginx/nginx.conf #编辑配置文件

User Nginx Nginx; #修改nginx operation account; Nginx user of Nginx Group

: Wq #保存退出

Cp/etc/nginx/conf.d/default.conf/etc/nginx/conf.d/default.confbak #备份原有的配置文件

Vim/etc/nginx/conf.d/default.conf #编辑配置文件

Index index.php index.html index.htm, #添加index PHP (approximately 14 rows or so):

Lnmp

#pass the PHP scripts to FastCGI server listening on 127.0.0.1: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

#取消FastCGI the comment for the server section location, and note the parameters of the Fastcgi_param line, change to $document_root$fastcgi_script_name, or use the absolute path

Service Nginx Restart #重启nginx

This article is from the Linux commune website (www.linuxidc.com) Source Link: http://www.linuxidc.com/Linux/2014-08/105128p3.htm

Two. PHP Configuration

Vim/etc/php.ini #编辑

Date.timezone = PRC #在878行左右 Remove the preceding semicolon and change to Date.timezone = PRC

Lnmp

expose_php = Off #在375行左右禁止显示PHP版本信息

Lnmp

Short_open_tag = on #在211行支持PHP短标签

Lnmp

: Wq #保存退出

Three. Configure PHP-FPM

Cp/etc/php-fpm.d/www.conf/etc/php-fpm.d/www.confbak #备份原有配置文件

Vim/etc/php-fpm.d/www.conf #编辑

user = Nginx # Modify users to Nginx

Group = Nginx #修改组为nginx

: Wq #保存退出

Lnmp

Test article

Cd/usr/share/nginx/html

Vim index.php #添加一下代码

Phpinfo ();

?>

: Wq #保存退出

Chown Nginx.nginx/usr/share/nginx/html-r #设置权限

Service Nginx Restart #重启nginx

Service php-fpm Restart #重启php-fpm

Lnmp

Enter the server IP address in the client browser to see the relevant configuration information

Description LNMP Configuration Succeeded


To this, CentOS6.4 installation configuration Lnmp (Nginx+php+mysql) completed,

1. Download WordPress website code

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

and unzip

2. Delete the/usr/share/nginx/html files below and copy the WordPress source code just extracted to this directory (note: Is the copy of the files inside the WordPress copy into, not to copy WordPress this folder)

Lnmp

3. Create a WordPress database

Mysql-u root-p #以root用户登录 mysql input password

Lnmp

mysql> CREATE DATABASE Zrq; #创建名为zrq的数据库

Lnmp

mysql> use ZRQ; #按回车键出现Database changed when the operation is successful! )

4. Install WordPress

Enter the IP address of the server in the client open browser:

Lnmp

Click Create Profile:

Lnmp

Click on "Start Now"

Lnmp

Modify the permissions of the/usr/share/nginx/html before committing

chmod 777-r/usr/share/nginx/html

Click Submit when you have finished editing:

Lnmp

Click to install and enter the relevant website information:

Lnmp

Click Install wordpress, the screen shows that the blog building success.

Lnmp

Lnmp

The interface after login


Congratulations on your successful website building!

This article is from the Linux commune website (www.linuxidc.com) Source Link: http://www.linuxidc.com/Linux/2014-08/105128p5.htm


This article is from the "Linux_ ant" blog, please make sure to keep this source http://onlyoulinux.blog.51cto.com/7941460/1601582

CentOS 6.4 Installation Configuration Lnmp Server (nginx+php+mysql) and build WordPress

Related Article

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.